|
1
|
|
|
/*! |
|
2
|
|
|
* jQuery JavaScript Library v3.1.1 -ajax,-ajax/jsonp,-ajax/load,-ajax/parseXML,-ajax/script,-ajax/var/location,-ajax/var/nonce,-ajax/var/rquery,-ajax/xhr,-manipulation/_evalUrl,-event/ajax,-effects,-effects/animatedSelector,-effects/Tween,-deprecated |
|
3
|
|
|
* https://jquery.com/ |
|
4
|
|
|
* |
|
5
|
|
|
* Includes Sizzle.js |
|
6
|
|
|
* https://sizzlejs.com/ |
|
7
|
|
|
* |
|
8
|
|
|
* Copyright jQuery Foundation and other contributors |
|
9
|
|
|
* Released under the MIT license |
|
10
|
|
|
* https://jquery.org/license |
|
11
|
|
|
* |
|
12
|
|
|
* Date: 2016-09-22T22:30Z |
|
13
|
|
|
*/ |
|
14
|
|
|
( function( global, factory ) { |
|
15
|
|
|
|
|
16
|
|
|
"use strict"; |
|
17
|
|
|
|
|
18
|
|
|
if ( typeof module === "object" && typeof module.exports === "object" ) { |
|
19
|
|
|
|
|
20
|
|
|
// For CommonJS and CommonJS-like environments where a proper `window` |
|
21
|
|
|
// is present, execute the factory and get jQuery. |
|
22
|
|
|
// For environments that do not have a `window` with a `document` |
|
23
|
|
|
// (such as Node.js), expose a factory as module.exports. |
|
24
|
|
|
// This accentuates the need for the creation of a real `window`. |
|
25
|
|
|
// e.g. var jQuery = require("jquery")(window); |
|
26
|
|
|
// See ticket #14549 for more info. |
|
27
|
|
|
module.exports = global.document ? |
|
28
|
|
|
factory( global, true ) : |
|
29
|
|
|
function( w ) { |
|
30
|
|
|
if ( !w.document ) { |
|
31
|
|
|
throw new Error( "jQuery requires a window with a document" ); |
|
32
|
|
|
} |
|
33
|
|
|
return factory( w ); |
|
34
|
|
|
}; |
|
35
|
|
|
} else { |
|
36
|
|
|
factory( global ); |
|
37
|
|
|
} |
|
38
|
|
|
|
|
39
|
|
|
// Pass this if window is not defined yet |
|
40
|
|
|
} )( typeof window !== "undefined" ? window : this, function( window, noGlobal ) { |
|
41
|
|
|
|
|
42
|
|
|
// Edge <= 12 - 13+, Firefox <=18 - 45+, IE 10 - 11, Safari 5.1 - 9+, iOS 6 - 9.1 |
|
43
|
|
|
// throw exceptions when non-strict code (e.g., ASP.NET 4.5) accesses strict mode |
|
44
|
|
|
// arguments.callee.caller (trac-13335). But as of jQuery 3.0 (2016), strict mode should be common |
|
45
|
|
|
// enough that all such attempts are guarded in a try block. |
|
46
|
|
|
"use strict"; |
|
47
|
|
|
|
|
48
|
|
|
var arr = []; |
|
49
|
|
|
|
|
50
|
|
|
var document = window.document; |
|
51
|
|
|
|
|
52
|
|
|
var getProto = Object.getPrototypeOf; |
|
53
|
|
|
|
|
54
|
|
|
var slice = arr.slice; |
|
55
|
|
|
|
|
56
|
|
|
var concat = arr.concat; |
|
57
|
|
|
|
|
58
|
|
|
var push = arr.push; |
|
59
|
|
|
|
|
60
|
|
|
var indexOf = arr.indexOf; |
|
61
|
|
|
|
|
62
|
|
|
var class2type = {}; |
|
63
|
|
|
|
|
64
|
|
|
var toString = class2type.toString; |
|
65
|
|
|
|
|
66
|
|
|
var hasOwn = class2type.hasOwnProperty; |
|
67
|
|
|
|
|
68
|
|
|
var fnToString = hasOwn.toString; |
|
69
|
|
|
|
|
70
|
|
|
var ObjectFunctionString = fnToString.call( Object ); |
|
71
|
|
|
|
|
72
|
|
|
var support = {}; |
|
73
|
|
|
|
|
74
|
|
|
|
|
75
|
|
|
|
|
76
|
|
|
function DOMEval( code, doc ) { |
|
77
|
|
|
doc = doc || document; |
|
78
|
|
|
|
|
79
|
|
|
var script = doc.createElement( "script" ); |
|
80
|
|
|
|
|
81
|
|
|
script.text = code; |
|
82
|
|
|
doc.head.appendChild( script ).parentNode.removeChild( script ); |
|
83
|
|
|
} |
|
84
|
|
|
/* global Symbol */ |
|
85
|
|
|
// Defining this global in .eslintrc.json would create a danger of using the global |
|
86
|
|
|
// unguarded in another place, it seems safer to define global only for this module |
|
87
|
|
|
|
|
88
|
|
|
|
|
89
|
|
|
|
|
90
|
|
|
var |
|
91
|
|
|
version = "3.1.1 -ajax,-ajax/jsonp,-ajax/load,-ajax/parseXML,-ajax/script,-ajax/var/location,-ajax/var/nonce,-ajax/var/rquery,-ajax/xhr,-manipulation/_evalUrl,-event/ajax,-effects,-effects/animatedSelector,-effects/Tween,-deprecated", |
|
92
|
|
|
|
|
93
|
|
|
// Define a local copy of jQuery |
|
94
|
|
|
jQuery = function( selector, context ) { |
|
95
|
|
|
|
|
96
|
|
|
// The jQuery object is actually just the init constructor 'enhanced' |
|
97
|
|
|
// Need init if jQuery is called (just allow error to be thrown if not included) |
|
98
|
|
|
return new jQuery.fn.init( selector, context ); |
|
99
|
|
|
}, |
|
100
|
|
|
|
|
101
|
|
|
// Support: Android <=4.0 only |
|
102
|
|
|
// Make sure we trim BOM and NBSP |
|
103
|
|
|
rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, |
|
104
|
|
|
|
|
105
|
|
|
// Matches dashed string for camelizing |
|
106
|
|
|
rmsPrefix = /^-ms-/, |
|
107
|
|
|
rdashAlpha = /-([a-z])/g, |
|
108
|
|
|
|
|
109
|
|
|
// Used by jQuery.camelCase as callback to replace() |
|
110
|
|
|
fcamelCase = function( all, letter ) { |
|
111
|
|
|
return letter.toUpperCase(); |
|
112
|
|
|
}; |
|
113
|
|
|
|
|
114
|
|
|
jQuery.fn = jQuery.prototype = { |
|
115
|
|
|
|
|
116
|
|
|
// The current version of jQuery being used |
|
117
|
|
|
jquery: version, |
|
118
|
|
|
|
|
119
|
|
|
constructor: jQuery, |
|
120
|
|
|
|
|
121
|
|
|
// The default length of a jQuery object is 0 |
|
122
|
|
|
length: 0, |
|
123
|
|
|
|
|
124
|
|
|
toArray: function() { |
|
125
|
|
|
return slice.call( this ); |
|
126
|
|
|
}, |
|
127
|
|
|
|
|
128
|
|
|
// Get the Nth element in the matched element set OR |
|
129
|
|
|
// Get the whole matched element set as a clean array |
|
130
|
|
|
get: function( num ) { |
|
131
|
|
|
|
|
132
|
|
|
// Return all the elements in a clean array |
|
133
|
|
|
if ( num == null ) { |
|
134
|
|
|
return slice.call( this ); |
|
135
|
|
|
} |
|
136
|
|
|
|
|
137
|
|
|
// Return just the one element from the set |
|
138
|
|
|
return num < 0 ? this[ num + this.length ] : this[ num ]; |
|
139
|
|
|
}, |
|
140
|
|
|
|
|
141
|
|
|
// Take an array of elements and push it onto the stack |
|
142
|
|
|
// (returning the new matched element set) |
|
143
|
|
|
pushStack: function( elems ) { |
|
144
|
|
|
|
|
145
|
|
|
// Build a new jQuery matched element set |
|
146
|
|
|
var ret = jQuery.merge( this.constructor(), elems ); |
|
147
|
|
|
|
|
148
|
|
|
// Add the old object onto the stack (as a reference) |
|
149
|
|
|
ret.prevObject = this; |
|
150
|
|
|
|
|
151
|
|
|
// Return the newly-formed element set |
|
152
|
|
|
return ret; |
|
153
|
|
|
}, |
|
154
|
|
|
|
|
155
|
|
|
// Execute a callback for every element in the matched set. |
|
156
|
|
|
each: function( callback ) { |
|
157
|
|
|
return jQuery.each( this, callback ); |
|
158
|
|
|
}, |
|
159
|
|
|
|
|
160
|
|
|
map: function( callback ) { |
|
161
|
|
|
return this.pushStack( jQuery.map( this, function( elem, i ) { |
|
162
|
|
|
return callback.call( elem, i, elem ); |
|
163
|
|
|
} ) ); |
|
164
|
|
|
}, |
|
165
|
|
|
|
|
166
|
|
|
slice: function() { |
|
167
|
|
|
return this.pushStack( slice.apply( this, arguments ) ); |
|
168
|
|
|
}, |
|
169
|
|
|
|
|
170
|
|
|
first: function() { |
|
171
|
|
|
return this.eq( 0 ); |
|
172
|
|
|
}, |
|
173
|
|
|
|
|
174
|
|
|
last: function() { |
|
175
|
|
|
return this.eq( -1 ); |
|
176
|
|
|
}, |
|
177
|
|
|
|
|
178
|
|
|
eq: function( i ) { |
|
179
|
|
|
var len = this.length, |
|
180
|
|
|
j = +i + ( i < 0 ? len : 0 ); |
|
181
|
|
|
return this.pushStack( j >= 0 && j < len ? [ this[ j ] ] : [] ); |
|
182
|
|
|
}, |
|
183
|
|
|
|
|
184
|
|
|
end: function() { |
|
185
|
|
|
return this.prevObject || this.constructor(); |
|
186
|
|
|
}, |
|
187
|
|
|
|
|
188
|
|
|
// For internal use only. |
|
189
|
|
|
// Behaves like an Array's method, not like a jQuery method. |
|
190
|
|
|
push: push, |
|
191
|
|
|
sort: arr.sort, |
|
192
|
|
|
splice: arr.splice |
|
193
|
|
|
}; |
|
194
|
|
|
|
|
195
|
|
|
jQuery.extend = jQuery.fn.extend = function() { |
|
196
|
|
|
var options, name, src, copy, copyIsArray, clone, |
|
197
|
|
|
target = arguments[ 0 ] || {}, |
|
198
|
|
|
i = 1, |
|
199
|
|
|
length = arguments.length, |
|
200
|
|
|
deep = false; |
|
201
|
|
|
|
|
202
|
|
|
// Handle a deep copy situation |
|
203
|
|
|
if ( typeof target === "boolean" ) { |
|
204
|
|
|
deep = target; |
|
205
|
|
|
|
|
206
|
|
|
// Skip the boolean and the target |
|
207
|
|
|
target = arguments[ i ] || {}; |
|
208
|
|
|
i++; |
|
209
|
|
|
} |
|
210
|
|
|
|
|
211
|
|
|
// Handle case when target is a string or something (possible in deep copy) |
|
212
|
|
|
if ( typeof target !== "object" && !jQuery.isFunction( target ) ) { |
|
213
|
|
|
target = {}; |
|
214
|
|
|
} |
|
215
|
|
|
|
|
216
|
|
|
// Extend jQuery itself if only one argument is passed |
|
217
|
|
|
if ( i === length ) { |
|
218
|
|
|
target = this; |
|
219
|
|
|
i--; |
|
220
|
|
|
} |
|
221
|
|
|
|
|
222
|
|
|
for ( ; i < length; i++ ) { |
|
223
|
|
|
|
|
224
|
|
|
// Only deal with non-null/undefined values |
|
225
|
|
|
if ( ( options = arguments[ i ] ) != null ) { |
|
226
|
|
|
|
|
227
|
|
|
// Extend the base object |
|
228
|
|
|
for ( name in options ) { |
|
229
|
|
|
src = target[ name ]; |
|
230
|
|
|
copy = options[ name ]; |
|
231
|
|
|
|
|
232
|
|
|
// Prevent never-ending loop |
|
233
|
|
|
if ( target === copy ) { |
|
234
|
|
|
continue; |
|
235
|
|
|
} |
|
236
|
|
|
|
|
237
|
|
|
// Recurse if we're merging plain objects or arrays |
|
238
|
|
|
if ( deep && copy && ( jQuery.isPlainObject( copy ) || |
|
239
|
|
|
( copyIsArray = jQuery.isArray( copy ) ) ) ) { |
|
240
|
|
|
|
|
241
|
|
|
if ( copyIsArray ) { |
|
242
|
|
|
copyIsArray = false; |
|
243
|
|
|
clone = src && jQuery.isArray( src ) ? src : []; |
|
244
|
|
|
|
|
245
|
|
|
} else { |
|
246
|
|
|
clone = src && jQuery.isPlainObject( src ) ? src : {}; |
|
247
|
|
|
} |
|
248
|
|
|
|
|
249
|
|
|
// Never move original objects, clone them |
|
250
|
|
|
target[ name ] = jQuery.extend( deep, clone, copy ); |
|
251
|
|
|
|
|
252
|
|
|
// Don't bring in undefined values |
|
253
|
|
|
} else if ( copy !== undefined ) { |
|
254
|
|
|
target[ name ] = copy; |
|
255
|
|
|
} |
|
256
|
|
|
} |
|
257
|
|
|
} |
|
258
|
|
|
} |
|
259
|
|
|
|
|
260
|
|
|
// Return the modified object |
|
261
|
|
|
return target; |
|
262
|
|
|
}; |
|
263
|
|
|
|
|
264
|
|
|
jQuery.extend( { |
|
265
|
|
|
|
|
266
|
|
|
// Unique for each copy of jQuery on the page |
|
267
|
|
|
expando: "jQuery" + ( version + Math.random() ).replace( /\D/g, "" ), |
|
268
|
|
|
|
|
269
|
|
|
// Assume jQuery is ready without the ready module |
|
270
|
|
|
isReady: true, |
|
271
|
|
|
|
|
272
|
|
|
error: function( msg ) { |
|
273
|
|
|
throw new Error( msg ); |
|
274
|
|
|
}, |
|
275
|
|
|
|
|
276
|
|
|
noop: function() {}, |
|
277
|
|
|
|
|
278
|
|
|
isFunction: function( obj ) { |
|
279
|
|
|
return jQuery.type( obj ) === "function"; |
|
280
|
|
|
}, |
|
281
|
|
|
|
|
282
|
|
|
isArray: Array.isArray, |
|
283
|
|
|
|
|
284
|
|
|
isWindow: function( obj ) { |
|
285
|
|
|
return obj != null && obj === obj.window; |
|
286
|
|
|
}, |
|
287
|
|
|
|
|
288
|
|
|
isNumeric: function( obj ) { |
|
289
|
|
|
|
|
290
|
|
|
// As of jQuery 3.0, isNumeric is limited to |
|
291
|
|
|
// strings and numbers (primitives or objects) |
|
292
|
|
|
// that can be coerced to finite numbers (gh-2662) |
|
293
|
|
|
var type = jQuery.type( obj ); |
|
294
|
|
|
return ( type === "number" || type === "string" ) && |
|
295
|
|
|
|
|
296
|
|
|
// parseFloat NaNs numeric-cast false positives ("") |
|
297
|
|
|
// ...but misinterprets leading-number strings, particularly hex literals ("0x...") |
|
298
|
|
|
// subtraction forces infinities to NaN |
|
299
|
|
|
!isNaN( obj - parseFloat( obj ) ); |
|
300
|
|
|
}, |
|
301
|
|
|
|
|
302
|
|
|
isPlainObject: function( obj ) { |
|
303
|
|
|
var proto, Ctor; |
|
304
|
|
|
|
|
305
|
|
|
// Detect obvious negatives |
|
306
|
|
|
// Use toString instead of jQuery.type to catch host objects |
|
307
|
|
|
if ( !obj || toString.call( obj ) !== "[object Object]" ) { |
|
308
|
|
|
return false; |
|
309
|
|
|
} |
|
310
|
|
|
|
|
311
|
|
|
proto = getProto( obj ); |
|
312
|
|
|
|
|
313
|
|
|
// Objects with no prototype (e.g., `Object.create( null )`) are plain |
|
314
|
|
|
if ( !proto ) { |
|
315
|
|
|
return true; |
|
316
|
|
|
} |
|
317
|
|
|
|
|
318
|
|
|
// Objects with prototype are plain iff they were constructed by a global Object function |
|
319
|
|
|
Ctor = hasOwn.call( proto, "constructor" ) && proto.constructor; |
|
320
|
|
|
return typeof Ctor === "function" && fnToString.call( Ctor ) === ObjectFunctionString; |
|
321
|
|
|
}, |
|
322
|
|
|
|
|
323
|
|
|
isEmptyObject: function( obj ) { |
|
324
|
|
|
|
|
325
|
|
|
/* eslint-disable no-unused-vars */ |
|
326
|
|
|
// See https://github.com/eslint/eslint/issues/6125 |
|
327
|
|
|
var name; |
|
328
|
|
|
|
|
329
|
|
|
for ( name in obj ) { |
|
330
|
|
|
return false; |
|
331
|
|
|
} |
|
332
|
|
|
return true; |
|
333
|
|
|
}, |
|
334
|
|
|
|
|
335
|
|
|
type: function( obj ) { |
|
336
|
|
|
if ( obj == null ) { |
|
337
|
|
|
return obj + ""; |
|
338
|
|
|
} |
|
339
|
|
|
|
|
340
|
|
|
// Support: Android <=2.3 only (functionish RegExp) |
|
341
|
|
|
return typeof obj === "object" || typeof obj === "function" ? |
|
342
|
|
|
class2type[ toString.call( obj ) ] || "object" : |
|
343
|
|
|
typeof obj; |
|
344
|
|
|
}, |
|
345
|
|
|
|
|
346
|
|
|
// Evaluates a script in a global context |
|
347
|
|
|
globalEval: function( code ) { |
|
348
|
|
|
DOMEval( code ); |
|
349
|
|
|
}, |
|
350
|
|
|
|
|
351
|
|
|
// Convert dashed to camelCase; used by the css and data modules |
|
352
|
|
|
// Support: IE <=9 - 11, Edge 12 - 13 |
|
353
|
|
|
// Microsoft forgot to hump their vendor prefix (#9572) |
|
354
|
|
|
camelCase: function( string ) { |
|
355
|
|
|
return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase ); |
|
356
|
|
|
}, |
|
357
|
|
|
|
|
358
|
|
|
nodeName: function( elem, name ) { |
|
359
|
|
|
return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase(); |
|
360
|
|
|
}, |
|
361
|
|
|
|
|
362
|
|
|
each: function( obj, callback ) { |
|
363
|
|
|
var length, i = 0; |
|
364
|
|
|
|
|
365
|
|
|
if ( isArrayLike( obj ) ) { |
|
366
|
|
|
length = obj.length; |
|
367
|
|
|
for ( ; i < length; i++ ) { |
|
368
|
|
|
if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) { |
|
369
|
|
|
break; |
|
370
|
|
|
} |
|
371
|
|
|
} |
|
372
|
|
|
} else { |
|
373
|
|
|
for ( i in obj ) { |
|
374
|
|
|
if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) { |
|
375
|
|
|
break; |
|
376
|
|
|
} |
|
377
|
|
|
} |
|
378
|
|
|
} |
|
379
|
|
|
|
|
380
|
|
|
return obj; |
|
381
|
|
|
}, |
|
382
|
|
|
|
|
383
|
|
|
// Support: Android <=4.0 only |
|
384
|
|
|
trim: function( text ) { |
|
385
|
|
|
return text == null ? |
|
386
|
|
|
"" : |
|
387
|
|
|
( text + "" ).replace( rtrim, "" ); |
|
388
|
|
|
}, |
|
389
|
|
|
|
|
390
|
|
|
// results is for internal usage only |
|
391
|
|
|
makeArray: function( arr, results ) { |
|
392
|
|
|
var ret = results || []; |
|
393
|
|
|
|
|
394
|
|
|
if ( arr != null ) { |
|
395
|
|
|
if ( isArrayLike( Object( arr ) ) ) { |
|
396
|
|
|
jQuery.merge( ret, |
|
397
|
|
|
typeof arr === "string" ? |
|
398
|
|
|
[ arr ] : arr |
|
399
|
|
|
); |
|
400
|
|
|
} else { |
|
401
|
|
|
push.call( ret, arr ); |
|
402
|
|
|
} |
|
403
|
|
|
} |
|
404
|
|
|
|
|
405
|
|
|
return ret; |
|
406
|
|
|
}, |
|
407
|
|
|
|
|
408
|
|
|
inArray: function( elem, arr, i ) { |
|
409
|
|
|
return arr == null ? -1 : indexOf.call( arr, elem, i ); |
|
410
|
|
|
}, |
|
411
|
|
|
|
|
412
|
|
|
// Support: Android <=4.0 only, PhantomJS 1 only |
|
413
|
|
|
// push.apply(_, arraylike) throws on ancient WebKit |
|
414
|
|
|
merge: function( first, second ) { |
|
415
|
|
|
var len = +second.length, |
|
416
|
|
|
j = 0, |
|
417
|
|
|
i = first.length; |
|
418
|
|
|
|
|
419
|
|
|
for ( ; j < len; j++ ) { |
|
420
|
|
|
first[ i++ ] = second[ j ]; |
|
421
|
|
|
} |
|
422
|
|
|
|
|
423
|
|
|
first.length = i; |
|
424
|
|
|
|
|
425
|
|
|
return first; |
|
426
|
|
|
}, |
|
427
|
|
|
|
|
428
|
|
|
grep: function( elems, callback, invert ) { |
|
429
|
|
|
var callbackInverse, |
|
430
|
|
|
matches = [], |
|
431
|
|
|
i = 0, |
|
432
|
|
|
length = elems.length, |
|
433
|
|
|
callbackExpect = !invert; |
|
434
|
|
|
|
|
435
|
|
|
// Go through the array, only saving the items |
|
436
|
|
|
// that pass the validator function |
|
437
|
|
|
for ( ; i < length; i++ ) { |
|
438
|
|
|
callbackInverse = !callback( elems[ i ], i ); |
|
439
|
|
|
if ( callbackInverse !== callbackExpect ) { |
|
440
|
|
|
matches.push( elems[ i ] ); |
|
441
|
|
|
} |
|
442
|
|
|
} |
|
443
|
|
|
|
|
444
|
|
|
return matches; |
|
445
|
|
|
}, |
|
446
|
|
|
|
|
447
|
|
|
// arg is for internal usage only |
|
448
|
|
|
map: function( elems, callback, arg ) { |
|
449
|
|
|
var length, value, |
|
450
|
|
|
i = 0, |
|
451
|
|
|
ret = []; |
|
452
|
|
|
|
|
453
|
|
|
// Go through the array, translating each of the items to their new values |
|
454
|
|
|
if ( isArrayLike( elems ) ) { |
|
455
|
|
|
length = elems.length; |
|
456
|
|
|
for ( ; i < length; i++ ) { |
|
457
|
|
|
value = callback( elems[ i ], i, arg ); |
|
458
|
|
|
|
|
459
|
|
|
if ( value != null ) { |
|
460
|
|
|
ret.push( value ); |
|
461
|
|
|
} |
|
462
|
|
|
} |
|
463
|
|
|
|
|
464
|
|
|
// Go through every key on the object, |
|
465
|
|
|
} else { |
|
466
|
|
|
for ( i in elems ) { |
|
467
|
|
|
value = callback( elems[ i ], i, arg ); |
|
468
|
|
|
|
|
469
|
|
|
if ( value != null ) { |
|
470
|
|
|
ret.push( value ); |
|
471
|
|
|
} |
|
472
|
|
|
} |
|
473
|
|
|
} |
|
474
|
|
|
|
|
475
|
|
|
// Flatten any nested arrays |
|
476
|
|
|
return concat.apply( [], ret ); |
|
477
|
|
|
}, |
|
478
|
|
|
|
|
479
|
|
|
// A global GUID counter for objects |
|
480
|
|
|
guid: 1, |
|
481
|
|
|
|
|
482
|
|
|
// Bind a function to a context, optionally partially applying any |
|
483
|
|
|
// arguments. |
|
484
|
|
|
proxy: function( fn, context ) { |
|
485
|
|
|
var tmp, args, proxy; |
|
486
|
|
|
|
|
487
|
|
|
if ( typeof context === "string" ) { |
|
488
|
|
|
tmp = fn[ context ]; |
|
489
|
|
|
context = fn; |
|
490
|
|
|
fn = tmp; |
|
491
|
|
|
} |
|
492
|
|
|
|
|
493
|
|
|
// Quick check to determine if target is callable, in the spec |
|
494
|
|
|
// this throws a TypeError, but we will just return undefined. |
|
495
|
|
|
if ( !jQuery.isFunction( fn ) ) { |
|
496
|
|
|
return undefined; |
|
497
|
|
|
} |
|
498
|
|
|
|
|
499
|
|
|
// Simulated bind |
|
500
|
|
|
args = slice.call( arguments, 2 ); |
|
501
|
|
|
proxy = function() { |
|
502
|
|
|
return fn.apply( context || this, args.concat( slice.call( arguments ) ) ); |
|
503
|
|
|
}; |
|
504
|
|
|
|
|
505
|
|
|
// Set the guid of unique handler to the same of original handler, so it can be removed |
|
506
|
|
|
proxy.guid = fn.guid = fn.guid || jQuery.guid++; |
|
507
|
|
|
|
|
508
|
|
|
return proxy; |
|
509
|
|
|
}, |
|
510
|
|
|
|
|
511
|
|
|
now: Date.now, |
|
512
|
|
|
|
|
513
|
|
|
// jQuery.support is not used in Core but other projects attach their |
|
514
|
|
|
// properties to it so it needs to exist. |
|
515
|
|
|
support: support |
|
516
|
|
|
} ); |
|
517
|
|
|
|
|
518
|
|
|
if ( typeof Symbol === "function" ) { |
|
519
|
|
|
jQuery.fn[ Symbol.iterator ] = arr[ Symbol.iterator ]; |
|
520
|
|
|
} |
|
521
|
|
|
|
|
522
|
|
|
// Populate the class2type map |
|
523
|
|
|
jQuery.each( "Boolean Number String Function Array Date RegExp Object Error Symbol".split( " " ), |
|
524
|
|
|
function( i, name ) { |
|
525
|
|
|
class2type[ "[object " + name + "]" ] = name.toLowerCase(); |
|
526
|
|
|
} ); |
|
527
|
|
|
|
|
528
|
|
|
function isArrayLike( obj ) { |
|
529
|
|
|
|
|
530
|
|
|
// Support: real iOS 8.2 only (not reproducible in simulator) |
|
531
|
|
|
// `in` check used to prevent JIT error (gh-2145) |
|
532
|
|
|
// hasOwn isn't used here due to false negatives |
|
533
|
|
|
// regarding Nodelist length in IE |
|
534
|
|
|
var length = !!obj && "length" in obj && obj.length, |
|
535
|
|
|
type = jQuery.type( obj ); |
|
536
|
|
|
|
|
537
|
|
|
if ( type === "function" || jQuery.isWindow( obj ) ) { |
|
538
|
|
|
return false; |
|
539
|
|
|
} |
|
540
|
|
|
|
|
541
|
|
|
return type === "array" || length === 0 || |
|
542
|
|
|
typeof length === "number" && length > 0 && ( length - 1 ) in obj; |
|
543
|
|
|
} |
|
544
|
|
|
var Sizzle = |
|
545
|
|
|
/*! |
|
546
|
|
|
* Sizzle CSS Selector Engine v2.3.3 |
|
547
|
|
|
* https://sizzlejs.com/ |
|
548
|
|
|
* |
|
549
|
|
|
* Copyright jQuery Foundation and other contributors |
|
550
|
|
|
* Released under the MIT license |
|
551
|
|
|
* http://jquery.org/license |
|
552
|
|
|
* |
|
553
|
|
|
* Date: 2016-08-08 |
|
554
|
|
|
*/ |
|
555
|
|
|
(function( window ) { |
|
556
|
|
|
|
|
557
|
|
|
var i, |
|
558
|
|
|
support, |
|
559
|
|
|
Expr, |
|
560
|
|
|
getText, |
|
561
|
|
|
isXML, |
|
562
|
|
|
tokenize, |
|
563
|
|
|
compile, |
|
564
|
|
|
select, |
|
565
|
|
|
outermostContext, |
|
566
|
|
|
sortInput, |
|
567
|
|
|
hasDuplicate, |
|
568
|
|
|
|
|
569
|
|
|
// Local document vars |
|
570
|
|
|
setDocument, |
|
571
|
|
|
document, |
|
572
|
|
|
docElem, |
|
573
|
|
|
documentIsHTML, |
|
574
|
|
|
rbuggyQSA, |
|
575
|
|
|
rbuggyMatches, |
|
576
|
|
|
matches, |
|
577
|
|
|
contains, |
|
578
|
|
|
|
|
579
|
|
|
// Instance-specific data |
|
580
|
|
|
expando = "sizzle" + 1 * new Date(), |
|
581
|
|
|
preferredDoc = window.document, |
|
582
|
|
|
dirruns = 0, |
|
583
|
|
|
done = 0, |
|
584
|
|
|
classCache = createCache(), |
|
585
|
|
|
tokenCache = createCache(), |
|
586
|
|
|
compilerCache = createCache(), |
|
587
|
|
|
sortOrder = function( a, b ) { |
|
588
|
|
|
if ( a === b ) { |
|
589
|
|
|
hasDuplicate = true; |
|
590
|
|
|
} |
|
591
|
|
|
return 0; |
|
592
|
|
|
}, |
|
593
|
|
|
|
|
594
|
|
|
// Instance methods |
|
595
|
|
|
hasOwn = ({}).hasOwnProperty, |
|
596
|
|
|
arr = [], |
|
597
|
|
|
pop = arr.pop, |
|
598
|
|
|
push_native = arr.push, |
|
599
|
|
|
push = arr.push, |
|
600
|
|
|
slice = arr.slice, |
|
601
|
|
|
// Use a stripped-down indexOf as it's faster than native |
|
602
|
|
|
// https://jsperf.com/thor-indexof-vs-for/5 |
|
603
|
|
|
indexOf = function( list, elem ) { |
|
604
|
|
|
var i = 0, |
|
605
|
|
|
len = list.length; |
|
606
|
|
|
for ( ; i < len; i++ ) { |
|
607
|
|
|
if ( list[i] === elem ) { |
|
608
|
|
|
return i; |
|
609
|
|
|
} |
|
610
|
|
|
} |
|
611
|
|
|
return -1; |
|
612
|
|
|
}, |
|
613
|
|
|
|
|
614
|
|
|
booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped", |
|
615
|
|
|
|
|
616
|
|
|
// Regular expressions |
|
617
|
|
|
|
|
618
|
|
|
// http://www.w3.org/TR/css3-selectors/#whitespace |
|
619
|
|
|
whitespace = "[\\x20\\t\\r\\n\\f]", |
|
620
|
|
|
|
|
621
|
|
|
// http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier |
|
622
|
|
|
identifier = "(?:\\\\.|[\\w-]|[^\0-\\xa0])+", |
|
623
|
|
|
|
|
624
|
|
|
// Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors |
|
625
|
|
|
attributes = "\\[" + whitespace + "*(" + identifier + ")(?:" + whitespace + |
|
626
|
|
|
// Operator (capture 2) |
|
627
|
|
|
"*([*^$|!~]?=)" + whitespace + |
|
628
|
|
|
// "Attribute values must be CSS identifiers [capture 5] or strings [capture 3 or capture 4]" |
|
629
|
|
|
"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + whitespace + |
|
630
|
|
|
"*\\]", |
|
631
|
|
|
|
|
632
|
|
|
pseudos = ":(" + identifier + ")(?:\\((" + |
|
633
|
|
|
// To reduce the number of selectors needing tokenize in the preFilter, prefer arguments: |
|
634
|
|
|
// 1. quoted (capture 3; capture 4 or capture 5) |
|
635
|
|
|
"('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" + |
|
636
|
|
|
// 2. simple (capture 6) |
|
637
|
|
|
"((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" + |
|
638
|
|
|
// 3. anything else (capture 2) |
|
639
|
|
|
".*" + |
|
640
|
|
|
")\\)|)", |
|
641
|
|
|
|
|
642
|
|
|
// Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter |
|
643
|
|
|
rwhitespace = new RegExp( whitespace + "+", "g" ), |
|
644
|
|
|
rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ), |
|
645
|
|
|
|
|
646
|
|
|
rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ), |
|
647
|
|
|
rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*" ), |
|
648
|
|
|
|
|
649
|
|
|
rattributeQuotes = new RegExp( "=" + whitespace + "*([^\\]'\"]*?)" + whitespace + "*\\]", "g" ), |
|
650
|
|
|
|
|
651
|
|
|
rpseudo = new RegExp( pseudos ), |
|
652
|
|
|
ridentifier = new RegExp( "^" + identifier + "$" ), |
|
653
|
|
|
|
|
654
|
|
|
matchExpr = { |
|
655
|
|
|
"ID": new RegExp( "^#(" + identifier + ")" ), |
|
656
|
|
|
"CLASS": new RegExp( "^\\.(" + identifier + ")" ), |
|
657
|
|
|
"TAG": new RegExp( "^(" + identifier + "|[*])" ), |
|
658
|
|
|
"ATTR": new RegExp( "^" + attributes ), |
|
659
|
|
|
"PSEUDO": new RegExp( "^" + pseudos ), |
|
660
|
|
|
"CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace + |
|
661
|
|
|
"*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace + |
|
662
|
|
|
"*(\\d+)|))" + whitespace + "*\\)|)", "i" ), |
|
663
|
|
|
"bool": new RegExp( "^(?:" + booleans + ")$", "i" ), |
|
664
|
|
|
// For use in libraries implementing .is() |
|
665
|
|
|
// We use this for POS matching in `select` |
|
666
|
|
|
"needsContext": new RegExp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" + |
|
667
|
|
|
whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" ) |
|
668
|
|
|
}, |
|
669
|
|
|
|
|
670
|
|
|
rinputs = /^(?:input|select|textarea|button)$/i, |
|
671
|
|
|
rheader = /^h\d$/i, |
|
672
|
|
|
|
|
673
|
|
|
rnative = /^[^{]+\{\s*\[native \w/, |
|
674
|
|
|
|
|
675
|
|
|
// Easily-parseable/retrievable ID or TAG or CLASS selectors |
|
676
|
|
|
rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/, |
|
677
|
|
|
|
|
678
|
|
|
rsibling = /[+~]/, |
|
679
|
|
|
|
|
680
|
|
|
// CSS escapes |
|
681
|
|
|
// http://www.w3.org/TR/CSS21/syndata.html#escaped-characters |
|
682
|
|
|
runescape = new RegExp( "\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)", "ig" ), |
|
683
|
|
|
funescape = function( _, escaped, escapedWhitespace ) { |
|
684
|
|
|
var high = "0x" + escaped - 0x10000; |
|
685
|
|
|
// NaN means non-codepoint |
|
686
|
|
|
// Support: Firefox<24 |
|
687
|
|
|
// Workaround erroneous numeric interpretation of +"0x" |
|
688
|
|
|
return high !== high || escapedWhitespace ? |
|
689
|
|
|
escaped : |
|
690
|
|
|
high < 0 ? |
|
691
|
|
|
// BMP codepoint |
|
692
|
|
|
String.fromCharCode( high + 0x10000 ) : |
|
693
|
|
|
// Supplemental Plane codepoint (surrogate pair) |
|
694
|
|
|
String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 ); |
|
695
|
|
|
}, |
|
696
|
|
|
|
|
697
|
|
|
// CSS string/identifier serialization |
|
698
|
|
|
// https://drafts.csswg.org/cssom/#common-serializing-idioms |
|
699
|
|
|
rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g, |
|
700
|
|
|
fcssescape = function( ch, asCodePoint ) { |
|
701
|
|
|
if ( asCodePoint ) { |
|
702
|
|
|
|
|
703
|
|
|
// U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER |
|
704
|
|
|
if ( ch === "\0" ) { |
|
705
|
|
|
return "\uFFFD"; |
|
706
|
|
|
} |
|
707
|
|
|
|
|
708
|
|
|
// Control characters and (dependent upon position) numbers get escaped as code points |
|
709
|
|
|
return ch.slice( 0, -1 ) + "\\" + ch.charCodeAt( ch.length - 1 ).toString( 16 ) + " "; |
|
710
|
|
|
} |
|
711
|
|
|
|
|
712
|
|
|
// Other potentially-special ASCII characters get backslash-escaped |
|
713
|
|
|
return "\\" + ch; |
|
714
|
|
|
}, |
|
715
|
|
|
|
|
716
|
|
|
// Used for iframes |
|
717
|
|
|
// See setDocument() |
|
718
|
|
|
// Removing the function wrapper causes a "Permission Denied" |
|
719
|
|
|
// error in IE |
|
720
|
|
|
unloadHandler = function() { |
|
721
|
|
|
setDocument(); |
|
722
|
|
|
}, |
|
723
|
|
|
|
|
724
|
|
|
disabledAncestor = addCombinator( |
|
725
|
|
|
function( elem ) { |
|
726
|
|
|
return elem.disabled === true && ("form" in elem || "label" in elem); |
|
727
|
|
|
}, |
|
728
|
|
|
{ dir: "parentNode", next: "legend" } |
|
729
|
|
|
); |
|
730
|
|
|
|
|
731
|
|
|
// Optimize for push.apply( _, NodeList ) |
|
732
|
|
|
try { |
|
733
|
|
|
push.apply( |
|
734
|
|
|
(arr = slice.call( preferredDoc.childNodes )), |
|
735
|
|
|
preferredDoc.childNodes |
|
736
|
|
|
); |
|
737
|
|
|
// Support: Android<4.0 |
|
738
|
|
|
// Detect silently failing push.apply |
|
739
|
|
|
arr[ preferredDoc.childNodes.length ].nodeType; |
|
740
|
|
|
} catch ( e ) { |
|
741
|
|
|
push = { apply: arr.length ? |
|
742
|
|
|
|
|
743
|
|
|
// Leverage slice if possible |
|
744
|
|
|
function( target, els ) { |
|
745
|
|
|
push_native.apply( target, slice.call(els) ); |
|
746
|
|
|
} : |
|
747
|
|
|
|
|
748
|
|
|
// Support: IE<9 |
|
749
|
|
|
// Otherwise append directly |
|
750
|
|
|
function( target, els ) { |
|
751
|
|
|
var j = target.length, |
|
752
|
|
|
i = 0; |
|
753
|
|
|
// Can't trust NodeList.length |
|
754
|
|
|
while ( (target[j++] = els[i++]) ) {} |
|
755
|
|
|
target.length = j - 1; |
|
756
|
|
|
} |
|
757
|
|
|
}; |
|
758
|
|
|
} |
|
759
|
|
|
|
|
760
|
|
|
function Sizzle( selector, context, results, seed ) { |
|
761
|
|
|
var m, i, elem, nid, match, groups, newSelector, |
|
762
|
|
|
newContext = context && context.ownerDocument, |
|
763
|
|
|
|
|
764
|
|
|
// nodeType defaults to 9, since context defaults to document |
|
765
|
|
|
nodeType = context ? context.nodeType : 9; |
|
766
|
|
|
|
|
767
|
|
|
results = results || []; |
|
768
|
|
|
|
|
769
|
|
|
// Return early from calls with invalid selector or context |
|
770
|
|
|
if ( typeof selector !== "string" || !selector || |
|
771
|
|
|
nodeType !== 1 && nodeType !== 9 && nodeType !== 11 ) { |
|
772
|
|
|
|
|
773
|
|
|
return results; |
|
774
|
|
|
} |
|
775
|
|
|
|
|
776
|
|
|
// Try to shortcut find operations (as opposed to filters) in HTML documents |
|
777
|
|
|
if ( !seed ) { |
|
778
|
|
|
|
|
779
|
|
|
if ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) { |
|
780
|
|
|
setDocument( context ); |
|
781
|
|
|
} |
|
782
|
|
|
context = context || document; |
|
783
|
|
|
|
|
784
|
|
|
if ( documentIsHTML ) { |
|
785
|
|
|
|
|
786
|
|
|
// If the selector is sufficiently simple, try using a "get*By*" DOM method |
|
787
|
|
|
// (excepting DocumentFragment context, where the methods don't exist) |
|
788
|
|
|
if ( nodeType !== 11 && (match = rquickExpr.exec( selector )) ) { |
|
789
|
|
|
|
|
790
|
|
|
// ID selector |
|
791
|
|
|
if ( (m = match[1]) ) { |
|
792
|
|
|
|
|
793
|
|
|
// Document context |
|
794
|
|
|
if ( nodeType === 9 ) { |
|
795
|
|
|
if ( (elem = context.getElementById( m )) ) { |
|
796
|
|
|
|
|
797
|
|
|
// Support: IE, Opera, Webkit |
|
798
|
|
|
// TODO: identify versions |
|
799
|
|
|
// getElementById can match elements by name instead of ID |
|
800
|
|
|
if ( elem.id === m ) { |
|
801
|
|
|
results.push( elem ); |
|
802
|
|
|
return results; |
|
803
|
|
|
} |
|
804
|
|
|
} else { |
|
805
|
|
|
return results; |
|
806
|
|
|
} |
|
807
|
|
|
|
|
808
|
|
|
// Element context |
|
809
|
|
|
} else { |
|
810
|
|
|
|
|
811
|
|
|
// Support: IE, Opera, Webkit |
|
812
|
|
|
// TODO: identify versions |
|
813
|
|
|
// getElementById can match elements by name instead of ID |
|
814
|
|
|
if ( newContext && (elem = newContext.getElementById( m )) && |
|
815
|
|
|
contains( context, elem ) && |
|
816
|
|
|
elem.id === m ) { |
|
817
|
|
|
|
|
818
|
|
|
results.push( elem ); |
|
819
|
|
|
return results; |
|
820
|
|
|
} |
|
821
|
|
|
} |
|
822
|
|
|
|
|
823
|
|
|
// Type selector |
|
824
|
|
|
} else if ( match[2] ) { |
|
825
|
|
|
push.apply( results, context.getElementsByTagName( selector ) ); |
|
826
|
|
|
return results; |
|
827
|
|
|
|
|
828
|
|
|
// Class selector |
|
829
|
|
|
} else if ( (m = match[3]) && support.getElementsByClassName && |
|
830
|
|
|
context.getElementsByClassName ) { |
|
831
|
|
|
|
|
832
|
|
|
push.apply( results, context.getElementsByClassName( m ) ); |
|
833
|
|
|
return results; |
|
834
|
|
|
} |
|
835
|
|
|
} |
|
836
|
|
|
|
|
837
|
|
|
// Take advantage of querySelectorAll |
|
838
|
|
|
if ( support.qsa && |
|
839
|
|
|
!compilerCache[ selector + " " ] && |
|
840
|
|
|
(!rbuggyQSA || !rbuggyQSA.test( selector )) ) { |
|
841
|
|
|
|
|
842
|
|
|
if ( nodeType !== 1 ) { |
|
843
|
|
|
newContext = context; |
|
844
|
|
|
newSelector = selector; |
|
845
|
|
|
|
|
846
|
|
|
// qSA looks outside Element context, which is not what we want |
|
847
|
|
|
// Thanks to Andrew Dupont for this workaround technique |
|
848
|
|
|
// Support: IE <=8 |
|
849
|
|
|
// Exclude object elements |
|
850
|
|
|
} else if ( context.nodeName.toLowerCase() !== "object" ) { |
|
851
|
|
|
|
|
852
|
|
|
// Capture the context ID, setting it first if necessary |
|
853
|
|
|
if ( (nid = context.getAttribute( "id" )) ) { |
|
854
|
|
|
nid = nid.replace( rcssescape, fcssescape ); |
|
855
|
|
|
} else { |
|
856
|
|
|
context.setAttribute( "id", (nid = expando) ); |
|
857
|
|
|
} |
|
858
|
|
|
|
|
859
|
|
|
// Prefix every selector in the list |
|
860
|
|
|
groups = tokenize( selector ); |
|
861
|
|
|
i = groups.length; |
|
862
|
|
|
while ( i-- ) { |
|
863
|
|
|
groups[i] = "#" + nid + " " + toSelector( groups[i] ); |
|
864
|
|
|
} |
|
865
|
|
|
newSelector = groups.join( "," ); |
|
866
|
|
|
|
|
867
|
|
|
// Expand context for sibling selectors |
|
868
|
|
|
newContext = rsibling.test( selector ) && testContext( context.parentNode ) || |
|
869
|
|
|
context; |
|
870
|
|
|
} |
|
871
|
|
|
|
|
872
|
|
|
if ( newSelector ) { |
|
873
|
|
|
try { |
|
874
|
|
|
push.apply( results, |
|
875
|
|
|
newContext.querySelectorAll( newSelector ) |
|
876
|
|
|
); |
|
877
|
|
|
return results; |
|
878
|
|
|
} catch ( qsaError ) { |
|
879
|
|
|
} finally { |
|
880
|
|
|
if ( nid === expando ) { |
|
881
|
|
|
context.removeAttribute( "id" ); |
|
882
|
|
|
} |
|
883
|
|
|
} |
|
884
|
|
|
} |
|
885
|
|
|
} |
|
886
|
|
|
} |
|
887
|
|
|
} |
|
888
|
|
|
|
|
889
|
|
|
// All others |
|
890
|
|
|
return select( selector.replace( rtrim, "$1" ), context, results, seed ); |
|
891
|
|
|
} |
|
892
|
|
|
|
|
893
|
|
|
/** |
|
894
|
|
|
* Create key-value caches of limited size |
|
895
|
|
|
* @returns {function(string, object)} Returns the Object data after storing it on itself with |
|
896
|
|
|
* property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength) |
|
897
|
|
|
* deleting the oldest entry |
|
898
|
|
|
*/ |
|
899
|
|
|
function createCache() { |
|
900
|
|
|
var keys = []; |
|
901
|
|
|
|
|
902
|
|
|
function cache( key, value ) { |
|
903
|
|
|
// Use (key + " ") to avoid collision with native prototype properties (see Issue #157) |
|
904
|
|
|
if ( keys.push( key + " " ) > Expr.cacheLength ) { |
|
905
|
|
|
// Only keep the most recent entries |
|
906
|
|
|
delete cache[ keys.shift() ]; |
|
907
|
|
|
} |
|
908
|
|
|
return (cache[ key + " " ] = value); |
|
909
|
|
|
} |
|
910
|
|
|
return cache; |
|
911
|
|
|
} |
|
912
|
|
|
|
|
913
|
|
|
/** |
|
914
|
|
|
* Mark a function for special use by Sizzle |
|
915
|
|
|
* @param {Function} fn The function to mark |
|
916
|
|
|
*/ |
|
917
|
|
|
function markFunction( fn ) { |
|
918
|
|
|
fn[ expando ] = true; |
|
919
|
|
|
return fn; |
|
920
|
|
|
} |
|
921
|
|
|
|
|
922
|
|
|
/** |
|
923
|
|
|
* Support testing using an element |
|
924
|
|
|
* @param {Function} fn Passed the created element and returns a boolean result |
|
925
|
|
|
*/ |
|
926
|
|
|
function assert( fn ) { |
|
927
|
|
|
var el = document.createElement("fieldset"); |
|
928
|
|
|
|
|
929
|
|
|
try { |
|
930
|
|
|
return !!fn( el ); |
|
931
|
|
|
} catch (e) { |
|
932
|
|
|
return false; |
|
933
|
|
|
} finally { |
|
934
|
|
|
// Remove from its parent by default |
|
935
|
|
|
if ( el.parentNode ) { |
|
936
|
|
|
el.parentNode.removeChild( el ); |
|
937
|
|
|
} |
|
938
|
|
|
// release memory in IE |
|
939
|
|
|
el = null; |
|
940
|
|
|
} |
|
941
|
|
|
} |
|
942
|
|
|
|
|
943
|
|
|
/** |
|
944
|
|
|
* Adds the same handler for all of the specified attrs |
|
945
|
|
|
* @param {String} attrs Pipe-separated list of attributes |
|
946
|
|
|
* @param {Function} handler The method that will be applied |
|
947
|
|
|
*/ |
|
948
|
|
|
function addHandle( attrs, handler ) { |
|
949
|
|
|
var arr = attrs.split("|"), |
|
950
|
|
|
i = arr.length; |
|
951
|
|
|
|
|
952
|
|
|
while ( i-- ) { |
|
953
|
|
|
Expr.attrHandle[ arr[i] ] = handler; |
|
954
|
|
|
} |
|
955
|
|
|
} |
|
956
|
|
|
|
|
957
|
|
|
/** |
|
958
|
|
|
* Checks document order of two siblings |
|
959
|
|
|
* @param {Element} a |
|
960
|
|
|
* @param {Element} b |
|
961
|
|
|
* @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b |
|
962
|
|
|
*/ |
|
963
|
|
|
function siblingCheck( a, b ) { |
|
964
|
|
|
var cur = b && a, |
|
965
|
|
|
diff = cur && a.nodeType === 1 && b.nodeType === 1 && |
|
966
|
|
|
a.sourceIndex - b.sourceIndex; |
|
967
|
|
|
|
|
968
|
|
|
// Use IE sourceIndex if available on both nodes |
|
969
|
|
|
if ( diff ) { |
|
970
|
|
|
return diff; |
|
971
|
|
|
} |
|
972
|
|
|
|
|
973
|
|
|
// Check if b follows a |
|
974
|
|
|
if ( cur ) { |
|
975
|
|
|
while ( (cur = cur.nextSibling) ) { |
|
976
|
|
|
if ( cur === b ) { |
|
977
|
|
|
return -1; |
|
978
|
|
|
} |
|
979
|
|
|
} |
|
980
|
|
|
} |
|
981
|
|
|
|
|
982
|
|
|
return a ? 1 : -1; |
|
983
|
|
|
} |
|
984
|
|
|
|
|
985
|
|
|
/** |
|
986
|
|
|
* Returns a function to use in pseudos for input types |
|
987
|
|
|
* @param {String} type |
|
988
|
|
|
*/ |
|
989
|
|
|
function createInputPseudo( type ) { |
|
990
|
|
|
return function( elem ) { |
|
991
|
|
|
var name = elem.nodeName.toLowerCase(); |
|
992
|
|
|
return name === "input" && elem.type === type; |
|
993
|
|
|
}; |
|
994
|
|
|
} |
|
995
|
|
|
|
|
996
|
|
|
/** |
|
997
|
|
|
* Returns a function to use in pseudos for buttons |
|
998
|
|
|
* @param {String} type |
|
999
|
|
|
*/ |
|
1000
|
|
|
function createButtonPseudo( type ) { |
|
1001
|
|
|
return function( elem ) { |
|
1002
|
|
|
var name = elem.nodeName.toLowerCase(); |
|
1003
|
|
|
return (name === "input" || name === "button") && elem.type === type; |
|
1004
|
|
|
}; |
|
1005
|
|
|
} |
|
1006
|
|
|
|
|
1007
|
|
|
/** |
|
1008
|
|
|
* Returns a function to use in pseudos for :enabled/:disabled |
|
1009
|
|
|
* @param {Boolean} disabled true for :disabled; false for :enabled |
|
1010
|
|
|
*/ |
|
1011
|
|
|
function createDisabledPseudo( disabled ) { |
|
1012
|
|
|
|
|
1013
|
|
|
// Known :disabled false positives: fieldset[disabled] > legend:nth-of-type(n+2) :can-disable |
|
1014
|
|
|
return function( elem ) { |
|
1015
|
|
|
|
|
1016
|
|
|
// Only certain elements can match :enabled or :disabled |
|
1017
|
|
|
// https://html.spec.whatwg.org/multipage/scripting.html#selector-enabled |
|
1018
|
|
|
// https://html.spec.whatwg.org/multipage/scripting.html#selector-disabled |
|
1019
|
|
|
if ( "form" in elem ) { |
|
1020
|
|
|
|
|
1021
|
|
|
// Check for inherited disabledness on relevant non-disabled elements: |
|
1022
|
|
|
// * listed form-associated elements in a disabled fieldset |
|
1023
|
|
|
// https://html.spec.whatwg.org/multipage/forms.html#category-listed |
|
1024
|
|
|
// https://html.spec.whatwg.org/multipage/forms.html#concept-fe-disabled |
|
1025
|
|
|
// * option elements in a disabled optgroup |
|
1026
|
|
|
// https://html.spec.whatwg.org/multipage/forms.html#concept-option-disabled |
|
1027
|
|
|
// All such elements have a "form" property. |
|
1028
|
|
|
if ( elem.parentNode && elem.disabled === false ) { |
|
1029
|
|
|
|
|
1030
|
|
|
// Option elements defer to a parent optgroup if present |
|
1031
|
|
|
if ( "label" in elem ) { |
|
1032
|
|
|
if ( "label" in elem.parentNode ) { |
|
1033
|
|
|
return elem.parentNode.disabled === disabled; |
|
1034
|
|
|
} else { |
|
1035
|
|
|
return elem.disabled === disabled; |
|
1036
|
|
|
} |
|
1037
|
|
|
} |
|
1038
|
|
|
|
|
1039
|
|
|
// Support: IE 6 - 11 |
|
1040
|
|
|
// Use the isDisabled shortcut property to check for disabled fieldset ancestors |
|
1041
|
|
|
return elem.isDisabled === disabled || |
|
1042
|
|
|
|
|
1043
|
|
|
// Where there is no isDisabled, check manually |
|
1044
|
|
|
/* jshint -W018 */ |
|
1045
|
|
|
elem.isDisabled !== !disabled && |
|
1046
|
|
|
disabledAncestor( elem ) === disabled; |
|
1047
|
|
|
} |
|
1048
|
|
|
|
|
1049
|
|
|
return elem.disabled === disabled; |
|
1050
|
|
|
|
|
1051
|
|
|
// Try to winnow out elements that can't be disabled before trusting the disabled property. |
|
1052
|
|
|
// Some victims get caught in our net (label, legend, menu, track), but it shouldn't |
|
1053
|
|
|
// even exist on them, let alone have a boolean value. |
|
1054
|
|
|
} else if ( "label" in elem ) { |
|
1055
|
|
|
return elem.disabled === disabled; |
|
1056
|
|
|
} |
|
1057
|
|
|
|
|
1058
|
|
|
// Remaining elements are neither :enabled nor :disabled |
|
1059
|
|
|
return false; |
|
1060
|
|
|
}; |
|
1061
|
|
|
} |
|
1062
|
|
|
|
|
1063
|
|
|
/** |
|
1064
|
|
|
* Returns a function to use in pseudos for positionals |
|
1065
|
|
|
* @param {Function} fn |
|
1066
|
|
|
*/ |
|
1067
|
|
|
function createPositionalPseudo( fn ) { |
|
1068
|
|
|
return markFunction(function( argument ) { |
|
1069
|
|
|
argument = +argument; |
|
1070
|
|
|
return markFunction(function( seed, matches ) { |
|
1071
|
|
|
var j, |
|
1072
|
|
|
matchIndexes = fn( [], seed.length, argument ), |
|
1073
|
|
|
i = matchIndexes.length; |
|
1074
|
|
|
|
|
1075
|
|
|
// Match elements found at the specified indexes |
|
1076
|
|
|
while ( i-- ) { |
|
1077
|
|
|
if ( seed[ (j = matchIndexes[i]) ] ) { |
|
1078
|
|
|
seed[j] = !(matches[j] = seed[j]); |
|
1079
|
|
|
} |
|
1080
|
|
|
} |
|
1081
|
|
|
}); |
|
1082
|
|
|
}); |
|
1083
|
|
|
} |
|
1084
|
|
|
|
|
1085
|
|
|
/** |
|
1086
|
|
|
* Checks a node for validity as a Sizzle context |
|
1087
|
|
|
* @param {Element|Object=} context |
|
1088
|
|
|
* @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value |
|
1089
|
|
|
*/ |
|
1090
|
|
|
function testContext( context ) { |
|
1091
|
|
|
return context && typeof context.getElementsByTagName !== "undefined" && context; |
|
1092
|
|
|
} |
|
1093
|
|
|
|
|
1094
|
|
|
// Expose support vars for convenience |
|
1095
|
|
|
support = Sizzle.support = {}; |
|
1096
|
|
|
|
|
1097
|
|
|
/** |
|
1098
|
|
|
* Detects XML nodes |
|
1099
|
|
|
* @param {Element|Object} elem An element or a document |
|
1100
|
|
|
* @returns {Boolean} True iff elem is a non-HTML XML node |
|
1101
|
|
|
*/ |
|
1102
|
|
|
isXML = Sizzle.isXML = function( elem ) { |
|
1103
|
|
|
// documentElement is verified for cases where it doesn't yet exist |
|
1104
|
|
|
// (such as loading iframes in IE - #4833) |
|
1105
|
|
|
var documentElement = elem && (elem.ownerDocument || elem).documentElement; |
|
1106
|
|
|
return documentElement ? documentElement.nodeName !== "HTML" : false; |
|
1107
|
|
|
}; |
|
1108
|
|
|
|
|
1109
|
|
|
/** |
|
1110
|
|
|
* Sets document-related variables once based on the current document |
|
1111
|
|
|
* @param {Element|Object} [doc] An element or document object to use to set the document |
|
1112
|
|
|
* @returns {Object} Returns the current document |
|
1113
|
|
|
*/ |
|
1114
|
|
|
setDocument = Sizzle.setDocument = function( node ) { |
|
1115
|
|
|
var hasCompare, subWindow, |
|
1116
|
|
|
doc = node ? node.ownerDocument || node : preferredDoc; |
|
1117
|
|
|
|
|
1118
|
|
|
// Return early if doc is invalid or already selected |
|
1119
|
|
|
if ( doc === document || doc.nodeType !== 9 || !doc.documentElement ) { |
|
1120
|
|
|
return document; |
|
1121
|
|
|
} |
|
1122
|
|
|
|
|
1123
|
|
|
// Update global variables |
|
1124
|
|
|
document = doc; |
|
1125
|
|
|
docElem = document.documentElement; |
|
1126
|
|
|
documentIsHTML = !isXML( document ); |
|
1127
|
|
|
|
|
1128
|
|
|
// Support: IE 9-11, Edge |
|
1129
|
|
|
// Accessing iframe documents after unload throws "permission denied" errors (jQuery #13936) |
|
1130
|
|
|
if ( preferredDoc !== document && |
|
1131
|
|
|
(subWindow = document.defaultView) && subWindow.top !== subWindow ) { |
|
1132
|
|
|
|
|
1133
|
|
|
// Support: IE 11, Edge |
|
1134
|
|
|
if ( subWindow.addEventListener ) { |
|
1135
|
|
|
subWindow.addEventListener( "unload", unloadHandler, false ); |
|
1136
|
|
|
|
|
1137
|
|
|
// Support: IE 9 - 10 only |
|
1138
|
|
|
} else if ( subWindow.attachEvent ) { |
|
1139
|
|
|
subWindow.attachEvent( "onunload", unloadHandler ); |
|
1140
|
|
|
} |
|
1141
|
|
|
} |
|
1142
|
|
|
|
|
1143
|
|
|
/* Attributes |
|
1144
|
|
|
---------------------------------------------------------------------- */ |
|
1145
|
|
|
|
|
1146
|
|
|
// Support: IE<8 |
|
1147
|
|
|
// Verify that getAttribute really returns attributes and not properties |
|
1148
|
|
|
// (excepting IE8 booleans) |
|
1149
|
|
|
support.attributes = assert(function( el ) { |
|
1150
|
|
|
el.className = "i"; |
|
1151
|
|
|
return !el.getAttribute("className"); |
|
1152
|
|
|
}); |
|
1153
|
|
|
|
|
1154
|
|
|
/* getElement(s)By* |
|
1155
|
|
|
---------------------------------------------------------------------- */ |
|
1156
|
|
|
|
|
1157
|
|
|
// Check if getElementsByTagName("*") returns only elements |
|
1158
|
|
|
support.getElementsByTagName = assert(function( el ) { |
|
1159
|
|
|
el.appendChild( document.createComment("") ); |
|
1160
|
|
|
return !el.getElementsByTagName("*").length; |
|
1161
|
|
|
}); |
|
1162
|
|
|
|
|
1163
|
|
|
// Support: IE<9 |
|
1164
|
|
|
support.getElementsByClassName = rnative.test( document.getElementsByClassName ); |
|
1165
|
|
|
|
|
1166
|
|
|
// Support: IE<10 |
|
1167
|
|
|
// Check if getElementById returns elements by name |
|
1168
|
|
|
// The broken getElementById methods don't pick up programmatically-set names, |
|
1169
|
|
|
// so use a roundabout getElementsByName test |
|
1170
|
|
|
support.getById = assert(function( el ) { |
|
1171
|
|
|
docElem.appendChild( el ).id = expando; |
|
1172
|
|
|
return !document.getElementsByName || !document.getElementsByName( expando ).length; |
|
1173
|
|
|
}); |
|
1174
|
|
|
|
|
1175
|
|
|
// ID filter and find |
|
1176
|
|
|
if ( support.getById ) { |
|
1177
|
|
|
Expr.filter["ID"] = function( id ) { |
|
1178
|
|
|
var attrId = id.replace( runescape, funescape ); |
|
1179
|
|
|
return function( elem ) { |
|
1180
|
|
|
return elem.getAttribute("id") === attrId; |
|
1181
|
|
|
}; |
|
1182
|
|
|
}; |
|
1183
|
|
|
Expr.find["ID"] = function( id, context ) { |
|
1184
|
|
|
if ( typeof context.getElementById !== "undefined" && documentIsHTML ) { |
|
1185
|
|
|
var elem = context.getElementById( id ); |
|
1186
|
|
|
return elem ? [ elem ] : []; |
|
1187
|
|
|
} |
|
1188
|
|
|
}; |
|
1189
|
|
|
} else { |
|
1190
|
|
|
Expr.filter["ID"] = function( id ) { |
|
1191
|
|
|
var attrId = id.replace( runescape, funescape ); |
|
1192
|
|
|
return function( elem ) { |
|
1193
|
|
|
var node = typeof elem.getAttributeNode !== "undefined" && |
|
1194
|
|
|
elem.getAttributeNode("id"); |
|
1195
|
|
|
return node && node.value === attrId; |
|
1196
|
|
|
}; |
|
1197
|
|
|
}; |
|
1198
|
|
|
|
|
1199
|
|
|
// Support: IE 6 - 7 only |
|
1200
|
|
|
// getElementById is not reliable as a find shortcut |
|
1201
|
|
|
Expr.find["ID"] = function( id, context ) { |
|
1202
|
|
|
if ( typeof context.getElementById !== "undefined" && documentIsHTML ) { |
|
1203
|
|
|
var node, i, elems, |
|
1204
|
|
|
elem = context.getElementById( id ); |
|
1205
|
|
|
|
|
1206
|
|
|
if ( elem ) { |
|
1207
|
|
|
|
|
1208
|
|
|
// Verify the id attribute |
|
1209
|
|
|
node = elem.getAttributeNode("id"); |
|
1210
|
|
|
if ( node && node.value === id ) { |
|
1211
|
|
|
return [ elem ]; |
|
1212
|
|
|
} |
|
1213
|
|
|
|
|
1214
|
|
|
// Fall back on getElementsByName |
|
1215
|
|
|
elems = context.getElementsByName( id ); |
|
1216
|
|
|
i = 0; |
|
1217
|
|
|
while ( (elem = elems[i++]) ) { |
|
1218
|
|
|
node = elem.getAttributeNode("id"); |
|
1219
|
|
|
if ( node && node.value === id ) { |
|
1220
|
|
|
return [ elem ]; |
|
1221
|
|
|
} |
|
1222
|
|
|
} |
|
1223
|
|
|
} |
|
1224
|
|
|
|
|
1225
|
|
|
return []; |
|
1226
|
|
|
} |
|
1227
|
|
|
}; |
|
1228
|
|
|
} |
|
1229
|
|
|
|
|
1230
|
|
|
// Tag |
|
1231
|
|
|
Expr.find["TAG"] = support.getElementsByTagName ? |
|
1232
|
|
|
function( tag, context ) { |
|
1233
|
|
|
if ( typeof context.getElementsByTagName !== "undefined" ) { |
|
1234
|
|
|
return context.getElementsByTagName( tag ); |
|
1235
|
|
|
|
|
1236
|
|
|
// DocumentFragment nodes don't have gEBTN |
|
1237
|
|
|
} else if ( support.qsa ) { |
|
1238
|
|
|
return context.querySelectorAll( tag ); |
|
1239
|
|
|
} |
|
1240
|
|
|
} : |
|
1241
|
|
|
|
|
1242
|
|
|
function( tag, context ) { |
|
1243
|
|
|
var elem, |
|
1244
|
|
|
tmp = [], |
|
1245
|
|
|
i = 0, |
|
1246
|
|
|
// By happy coincidence, a (broken) gEBTN appears on DocumentFragment nodes too |
|
1247
|
|
|
results = context.getElementsByTagName( tag ); |
|
1248
|
|
|
|
|
1249
|
|
|
// Filter out possible comments |
|
1250
|
|
|
if ( tag === "*" ) { |
|
1251
|
|
|
while ( (elem = results[i++]) ) { |
|
1252
|
|
|
if ( elem.nodeType === 1 ) { |
|
1253
|
|
|
tmp.push( elem ); |
|
1254
|
|
|
} |
|
1255
|
|
|
} |
|
1256
|
|
|
|
|
1257
|
|
|
return tmp; |
|
1258
|
|
|
} |
|
1259
|
|
|
return results; |
|
1260
|
|
|
}; |
|
1261
|
|
|
|
|
1262
|
|
|
// Class |
|
1263
|
|
|
Expr.find["CLASS"] = support.getElementsByClassName && function( className, context ) { |
|
1264
|
|
|
if ( typeof context.getElementsByClassName !== "undefined" && documentIsHTML ) { |
|
1265
|
|
|
return context.getElementsByClassName( className ); |
|
1266
|
|
|
} |
|
1267
|
|
|
}; |
|
1268
|
|
|
|
|
1269
|
|
|
/* QSA/matchesSelector |
|
1270
|
|
|
---------------------------------------------------------------------- */ |
|
1271
|
|
|
|
|
1272
|
|
|
// QSA and matchesSelector support |
|
1273
|
|
|
|
|
1274
|
|
|
// matchesSelector(:active) reports false when true (IE9/Opera 11.5) |
|
1275
|
|
|
rbuggyMatches = []; |
|
1276
|
|
|
|
|
1277
|
|
|
// qSa(:focus) reports false when true (Chrome 21) |
|
1278
|
|
|
// We allow this because of a bug in IE8/9 that throws an error |
|
1279
|
|
|
// whenever `document.activeElement` is accessed on an iframe |
|
1280
|
|
|
// So, we allow :focus to pass through QSA all the time to avoid the IE error |
|
1281
|
|
|
// See https://bugs.jquery.com/ticket/13378 |
|
1282
|
|
|
rbuggyQSA = []; |
|
1283
|
|
|
|
|
1284
|
|
|
if ( (support.qsa = rnative.test( document.querySelectorAll )) ) { |
|
1285
|
|
|
// Build QSA regex |
|
1286
|
|
|
// Regex strategy adopted from Diego Perini |
|
1287
|
|
|
assert(function( el ) { |
|
1288
|
|
|
// Select is set to empty string on purpose |
|
1289
|
|
|
// This is to test IE's treatment of not explicitly |
|
1290
|
|
|
// setting a boolean content attribute, |
|
1291
|
|
|
// since its presence should be enough |
|
1292
|
|
|
// https://bugs.jquery.com/ticket/12359 |
|
1293
|
|
|
docElem.appendChild( el ).innerHTML = "<a id='" + expando + "'></a>" + |
|
1294
|
|
|
"<select id='" + expando + "-\r\\' msallowcapture=''>" + |
|
1295
|
|
|
"<option selected=''></option></select>"; |
|
1296
|
|
|
|
|
1297
|
|
|
// Support: IE8, Opera 11-12.16 |
|
1298
|
|
|
// Nothing should be selected when empty strings follow ^= or $= or *= |
|
1299
|
|
|
// The test attribute must be unknown in Opera but "safe" for WinRT |
|
1300
|
|
|
// https://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section |
|
1301
|
|
|
if ( el.querySelectorAll("[msallowcapture^='']").length ) { |
|
1302
|
|
|
rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" ); |
|
1303
|
|
|
} |
|
1304
|
|
|
|
|
1305
|
|
|
// Support: IE8 |
|
1306
|
|
|
// Boolean attributes and "value" are not treated correctly |
|
1307
|
|
|
if ( !el.querySelectorAll("[selected]").length ) { |
|
1308
|
|
|
rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" ); |
|
1309
|
|
|
} |
|
1310
|
|
|
|
|
1311
|
|
|
// Support: Chrome<29, Android<4.4, Safari<7.0+, iOS<7.0+, PhantomJS<1.9.8+ |
|
1312
|
|
|
if ( !el.querySelectorAll( "[id~=" + expando + "-]" ).length ) { |
|
1313
|
|
|
rbuggyQSA.push("~="); |
|
1314
|
|
|
} |
|
1315
|
|
|
|
|
1316
|
|
|
// Webkit/Opera - :checked should return selected option elements |
|
1317
|
|
|
// http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked |
|
1318
|
|
|
// IE8 throws error here and will not see later tests |
|
1319
|
|
|
if ( !el.querySelectorAll(":checked").length ) { |
|
1320
|
|
|
rbuggyQSA.push(":checked"); |
|
1321
|
|
|
} |
|
1322
|
|
|
|
|
1323
|
|
|
// Support: Safari 8+, iOS 8+ |
|
1324
|
|
|
// https://bugs.webkit.org/show_bug.cgi?id=136851 |
|
1325
|
|
|
// In-page `selector#id sibling-combinator selector` fails |
|
1326
|
|
|
if ( !el.querySelectorAll( "a#" + expando + "+*" ).length ) { |
|
1327
|
|
|
rbuggyQSA.push(".#.+[+~]"); |
|
1328
|
|
|
} |
|
1329
|
|
|
}); |
|
1330
|
|
|
|
|
1331
|
|
|
assert(function( el ) { |
|
1332
|
|
|
el.innerHTML = "<a href='' disabled='disabled'></a>" + |
|
1333
|
|
|
"<select disabled='disabled'><option/></select>"; |
|
1334
|
|
|
|
|
1335
|
|
|
// Support: Windows 8 Native Apps |
|
1336
|
|
|
// The type and name attributes are restricted during .innerHTML assignment |
|
1337
|
|
|
var input = document.createElement("input"); |
|
1338
|
|
|
input.setAttribute( "type", "hidden" ); |
|
1339
|
|
|
el.appendChild( input ).setAttribute( "name", "D" ); |
|
1340
|
|
|
|
|
1341
|
|
|
// Support: IE8 |
|
1342
|
|
|
// Enforce case-sensitivity of name attribute |
|
1343
|
|
|
if ( el.querySelectorAll("[name=d]").length ) { |
|
1344
|
|
|
rbuggyQSA.push( "name" + whitespace + "*[*^$|!~]?=" ); |
|
1345
|
|
|
} |
|
1346
|
|
|
|
|
1347
|
|
|
// FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled) |
|
1348
|
|
|
// IE8 throws error here and will not see later tests |
|
1349
|
|
|
if ( el.querySelectorAll(":enabled").length !== 2 ) { |
|
1350
|
|
|
rbuggyQSA.push( ":enabled", ":disabled" ); |
|
1351
|
|
|
} |
|
1352
|
|
|
|
|
1353
|
|
|
// Support: IE9-11+ |
|
1354
|
|
|
// IE's :disabled selector does not pick up the children of disabled fieldsets |
|
1355
|
|
|
docElem.appendChild( el ).disabled = true; |
|
1356
|
|
|
if ( el.querySelectorAll(":disabled").length !== 2 ) { |
|
1357
|
|
|
rbuggyQSA.push( ":enabled", ":disabled" ); |
|
1358
|
|
|
} |
|
1359
|
|
|
|
|
1360
|
|
|
// Opera 10-11 does not throw on post-comma invalid pseudos |
|
1361
|
|
|
el.querySelectorAll("*,:x"); |
|
1362
|
|
|
rbuggyQSA.push(",.*:"); |
|
1363
|
|
|
}); |
|
1364
|
|
|
} |
|
1365
|
|
|
|
|
1366
|
|
|
if ( (support.matchesSelector = rnative.test( (matches = docElem.matches || |
|
1367
|
|
|
docElem.webkitMatchesSelector || |
|
1368
|
|
|
docElem.mozMatchesSelector || |
|
1369
|
|
|
docElem.oMatchesSelector || |
|
1370
|
|
|
docElem.msMatchesSelector) )) ) { |
|
1371
|
|
|
|
|
1372
|
|
|
assert(function( el ) { |
|
1373
|
|
|
// Check to see if it's possible to do matchesSelector |
|
1374
|
|
|
// on a disconnected node (IE 9) |
|
1375
|
|
|
support.disconnectedMatch = matches.call( el, "*" ); |
|
1376
|
|
|
|
|
1377
|
|
|
// This should fail with an exception |
|
1378
|
|
|
// Gecko does not error, returns false instead |
|
1379
|
|
|
matches.call( el, "[s!='']:x" ); |
|
1380
|
|
|
rbuggyMatches.push( "!=", pseudos ); |
|
1381
|
|
|
}); |
|
1382
|
|
|
} |
|
1383
|
|
|
|
|
1384
|
|
|
rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join("|") ); |
|
1385
|
|
|
rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join("|") ); |
|
1386
|
|
|
|
|
1387
|
|
|
/* Contains |
|
1388
|
|
|
---------------------------------------------------------------------- */ |
|
1389
|
|
|
hasCompare = rnative.test( docElem.compareDocumentPosition ); |
|
1390
|
|
|
|
|
1391
|
|
|
// Element contains another |
|
1392
|
|
|
// Purposefully self-exclusive |
|
1393
|
|
|
// As in, an element does not contain itself |
|
1394
|
|
|
contains = hasCompare || rnative.test( docElem.contains ) ? |
|
1395
|
|
|
function( a, b ) { |
|
1396
|
|
|
var adown = a.nodeType === 9 ? a.documentElement : a, |
|
1397
|
|
|
bup = b && b.parentNode; |
|
1398
|
|
|
return a === bup || !!( bup && bup.nodeType === 1 && ( |
|
1399
|
|
|
adown.contains ? |
|
1400
|
|
|
adown.contains( bup ) : |
|
1401
|
|
|
a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16 |
|
1402
|
|
|
)); |
|
1403
|
|
|
} : |
|
1404
|
|
|
function( a, b ) { |
|
1405
|
|
|
if ( b ) { |
|
1406
|
|
|
while ( (b = b.parentNode) ) { |
|
1407
|
|
|
if ( b === a ) { |
|
1408
|
|
|
return true; |
|
1409
|
|
|
} |
|
1410
|
|
|
} |
|
1411
|
|
|
} |
|
1412
|
|
|
return false; |
|
1413
|
|
|
}; |
|
1414
|
|
|
|
|
1415
|
|
|
/* Sorting |
|
1416
|
|
|
---------------------------------------------------------------------- */ |
|
1417
|
|
|
|
|
1418
|
|
|
// Document order sorting |
|
1419
|
|
|
sortOrder = hasCompare ? |
|
1420
|
|
|
function( a, b ) { |
|
1421
|
|
|
|
|
1422
|
|
|
// Flag for duplicate removal |
|
1423
|
|
|
if ( a === b ) { |
|
1424
|
|
|
hasDuplicate = true; |
|
1425
|
|
|
return 0; |
|
1426
|
|
|
} |
|
1427
|
|
|
|
|
1428
|
|
|
// Sort on method existence if only one input has compareDocumentPosition |
|
1429
|
|
|
var compare = !a.compareDocumentPosition - !b.compareDocumentPosition; |
|
1430
|
|
|
if ( compare ) { |
|
1431
|
|
|
return compare; |
|
1432
|
|
|
} |
|
1433
|
|
|
|
|
1434
|
|
|
// Calculate position if both inputs belong to the same document |
|
1435
|
|
|
compare = ( a.ownerDocument || a ) === ( b.ownerDocument || b ) ? |
|
1436
|
|
|
a.compareDocumentPosition( b ) : |
|
1437
|
|
|
|
|
1438
|
|
|
// Otherwise we know they are disconnected |
|
1439
|
|
|
1; |
|
1440
|
|
|
|
|
1441
|
|
|
// Disconnected nodes |
|
1442
|
|
|
if ( compare & 1 || |
|
1443
|
|
|
(!support.sortDetached && b.compareDocumentPosition( a ) === compare) ) { |
|
1444
|
|
|
|
|
1445
|
|
|
// Choose the first element that is related to our preferred document |
|
1446
|
|
|
if ( a === document || a.ownerDocument === preferredDoc && contains(preferredDoc, a) ) { |
|
1447
|
|
|
return -1; |
|
1448
|
|
|
} |
|
1449
|
|
|
if ( b === document || b.ownerDocument === preferredDoc && contains(preferredDoc, b) ) { |
|
1450
|
|
|
return 1; |
|
1451
|
|
|
} |
|
1452
|
|
|
|
|
1453
|
|
|
// Maintain original order |
|
1454
|
|
|
return sortInput ? |
|
1455
|
|
|
( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) : |
|
1456
|
|
|
0; |
|
1457
|
|
|
} |
|
1458
|
|
|
|
|
1459
|
|
|
return compare & 4 ? -1 : 1; |
|
1460
|
|
|
} : |
|
1461
|
|
|
function( a, b ) { |
|
1462
|
|
|
// Exit early if the nodes are identical |
|
1463
|
|
|
if ( a === b ) { |
|
1464
|
|
|
hasDuplicate = true; |
|
1465
|
|
|
return 0; |
|
1466
|
|
|
} |
|
1467
|
|
|
|
|
1468
|
|
|
var cur, |
|
1469
|
|
|
i = 0, |
|
1470
|
|
|
aup = a.parentNode, |
|
1471
|
|
|
bup = b.parentNode, |
|
1472
|
|
|
ap = [ a ], |
|
1473
|
|
|
bp = [ b ]; |
|
1474
|
|
|
|
|
1475
|
|
|
// Parentless nodes are either documents or disconnected |
|
1476
|
|
|
if ( !aup || !bup ) { |
|
1477
|
|
|
return a === document ? -1 : |
|
1478
|
|
|
b === document ? 1 : |
|
1479
|
|
|
aup ? -1 : |
|
1480
|
|
|
bup ? 1 : |
|
1481
|
|
|
sortInput ? |
|
1482
|
|
|
( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) : |
|
1483
|
|
|
0; |
|
1484
|
|
|
|
|
1485
|
|
|
// If the nodes are siblings, we can do a quick check |
|
1486
|
|
|
} else if ( aup === bup ) { |
|
1487
|
|
|
return siblingCheck( a, b ); |
|
1488
|
|
|
} |
|
1489
|
|
|
|
|
1490
|
|
|
// Otherwise we need full lists of their ancestors for comparison |
|
1491
|
|
|
cur = a; |
|
1492
|
|
|
while ( (cur = cur.parentNode) ) { |
|
1493
|
|
|
ap.unshift( cur ); |
|
1494
|
|
|
} |
|
1495
|
|
|
cur = b; |
|
1496
|
|
|
while ( (cur = cur.parentNode) ) { |
|
1497
|
|
|
bp.unshift( cur ); |
|
1498
|
|
|
} |
|
1499
|
|
|
|
|
1500
|
|
|
// Walk down the tree looking for a discrepancy |
|
1501
|
|
|
while ( ap[i] === bp[i] ) { |
|
1502
|
|
|
i++; |
|
1503
|
|
|
} |
|
1504
|
|
|
|
|
1505
|
|
|
return i ? |
|
1506
|
|
|
// Do a sibling check if the nodes have a common ancestor |
|
1507
|
|
|
siblingCheck( ap[i], bp[i] ) : |
|
1508
|
|
|
|
|
1509
|
|
|
// Otherwise nodes in our document sort first |
|
1510
|
|
|
ap[i] === preferredDoc ? -1 : |
|
1511
|
|
|
bp[i] === preferredDoc ? 1 : |
|
1512
|
|
|
0; |
|
1513
|
|
|
}; |
|
1514
|
|
|
|
|
1515
|
|
|
return document; |
|
1516
|
|
|
}; |
|
1517
|
|
|
|
|
1518
|
|
|
Sizzle.matches = function( expr, elements ) { |
|
1519
|
|
|
return Sizzle( expr, null, null, elements ); |
|
1520
|
|
|
}; |
|
1521
|
|
|
|
|
1522
|
|
|
Sizzle.matchesSelector = function( elem, expr ) { |
|
1523
|
|
|
// Set document vars if needed |
|
1524
|
|
|
if ( ( elem.ownerDocument || elem ) !== document ) { |
|
1525
|
|
|
setDocument( elem ); |
|
1526
|
|
|
} |
|
1527
|
|
|
|
|
1528
|
|
|
// Make sure that attribute selectors are quoted |
|
1529
|
|
|
expr = expr.replace( rattributeQuotes, "='$1']" ); |
|
1530
|
|
|
|
|
1531
|
|
|
if ( support.matchesSelector && documentIsHTML && |
|
1532
|
|
|
!compilerCache[ expr + " " ] && |
|
1533
|
|
|
( !rbuggyMatches || !rbuggyMatches.test( expr ) ) && |
|
1534
|
|
|
( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) { |
|
1535
|
|
|
|
|
1536
|
|
|
try { |
|
1537
|
|
|
var ret = matches.call( elem, expr ); |
|
1538
|
|
|
|
|
1539
|
|
|
// IE 9's matchesSelector returns false on disconnected nodes |
|
1540
|
|
|
if ( ret || support.disconnectedMatch || |
|
1541
|
|
|
// As well, disconnected nodes are said to be in a document |
|
1542
|
|
|
// fragment in IE 9 |
|
1543
|
|
|
elem.document && elem.document.nodeType !== 11 ) { |
|
1544
|
|
|
return ret; |
|
1545
|
|
|
} |
|
1546
|
|
|
} catch (e) {} |
|
1547
|
|
|
} |
|
1548
|
|
|
|
|
1549
|
|
|
return Sizzle( expr, document, null, [ elem ] ).length > 0; |
|
1550
|
|
|
}; |
|
1551
|
|
|
|
|
1552
|
|
|
Sizzle.contains = function( context, elem ) { |
|
1553
|
|
|
// Set document vars if needed |
|
1554
|
|
|
if ( ( context.ownerDocument || context ) !== document ) { |
|
1555
|
|
|
setDocument( context ); |
|
1556
|
|
|
} |
|
1557
|
|
|
return contains( context, elem ); |
|
1558
|
|
|
}; |
|
1559
|
|
|
|
|
1560
|
|
|
Sizzle.attr = function( elem, name ) { |
|
1561
|
|
|
// Set document vars if needed |
|
1562
|
|
|
if ( ( elem.ownerDocument || elem ) !== document ) { |
|
1563
|
|
|
setDocument( elem ); |
|
1564
|
|
|
} |
|
1565
|
|
|
|
|
1566
|
|
|
var fn = Expr.attrHandle[ name.toLowerCase() ], |
|
1567
|
|
|
// Don't get fooled by Object.prototype properties (jQuery #13807) |
|
1568
|
|
|
val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ? |
|
1569
|
|
|
fn( elem, name, !documentIsHTML ) : |
|
1570
|
|
|
undefined; |
|
1571
|
|
|
|
|
1572
|
|
|
return val !== undefined ? |
|
1573
|
|
|
val : |
|
1574
|
|
|
support.attributes || !documentIsHTML ? |
|
1575
|
|
|
elem.getAttribute( name ) : |
|
1576
|
|
|
(val = elem.getAttributeNode(name)) && val.specified ? |
|
1577
|
|
|
val.value : |
|
1578
|
|
|
null; |
|
1579
|
|
|
}; |
|
1580
|
|
|
|
|
1581
|
|
|
Sizzle.escape = function( sel ) { |
|
1582
|
|
|
return (sel + "").replace( rcssescape, fcssescape ); |
|
1583
|
|
|
}; |
|
1584
|
|
|
|
|
1585
|
|
|
Sizzle.error = function( msg ) { |
|
1586
|
|
|
throw new Error( "Syntax error, unrecognized expression: " + msg ); |
|
1587
|
|
|
}; |
|
1588
|
|
|
|
|
1589
|
|
|
/** |
|
1590
|
|
|
* Document sorting and removing duplicates |
|
1591
|
|
|
* @param {ArrayLike} results |
|
1592
|
|
|
*/ |
|
1593
|
|
|
Sizzle.uniqueSort = function( results ) { |
|
1594
|
|
|
var elem, |
|
1595
|
|
|
duplicates = [], |
|
1596
|
|
|
j = 0, |
|
1597
|
|
|
i = 0; |
|
1598
|
|
|
|
|
1599
|
|
|
// Unless we *know* we can detect duplicates, assume their presence |
|
1600
|
|
|
hasDuplicate = !support.detectDuplicates; |
|
1601
|
|
|
sortInput = !support.sortStable && results.slice( 0 ); |
|
1602
|
|
|
results.sort( sortOrder ); |
|
1603
|
|
|
|
|
1604
|
|
|
if ( hasDuplicate ) { |
|
1605
|
|
|
while ( (elem = results[i++]) ) { |
|
1606
|
|
|
if ( elem === results[ i ] ) { |
|
1607
|
|
|
j = duplicates.push( i ); |
|
1608
|
|
|
} |
|
1609
|
|
|
} |
|
1610
|
|
|
while ( j-- ) { |
|
1611
|
|
|
results.splice( duplicates[ j ], 1 ); |
|
1612
|
|
|
} |
|
1613
|
|
|
} |
|
1614
|
|
|
|
|
1615
|
|
|
// Clear input after sorting to release objects |
|
1616
|
|
|
// See https://github.com/jquery/sizzle/pull/225 |
|
1617
|
|
|
sortInput = null; |
|
1618
|
|
|
|
|
1619
|
|
|
return results; |
|
1620
|
|
|
}; |
|
1621
|
|
|
|
|
1622
|
|
|
/** |
|
1623
|
|
|
* Utility function for retrieving the text value of an array of DOM nodes |
|
1624
|
|
|
* @param {Array|Element} elem |
|
1625
|
|
|
*/ |
|
1626
|
|
|
getText = Sizzle.getText = function( elem ) { |
|
1627
|
|
|
var node, |
|
1628
|
|
|
ret = "", |
|
1629
|
|
|
i = 0, |
|
1630
|
|
|
nodeType = elem.nodeType; |
|
1631
|
|
|
|
|
1632
|
|
|
if ( !nodeType ) { |
|
1633
|
|
|
// If no nodeType, this is expected to be an array |
|
1634
|
|
|
while ( (node = elem[i++]) ) { |
|
1635
|
|
|
// Do not traverse comment nodes |
|
1636
|
|
|
ret += getText( node ); |
|
1637
|
|
|
} |
|
1638
|
|
|
} else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) { |
|
1639
|
|
|
// Use textContent for elements |
|
1640
|
|
|
// innerText usage removed for consistency of new lines (jQuery #11153) |
|
1641
|
|
|
if ( typeof elem.textContent === "string" ) { |
|
1642
|
|
|
return elem.textContent; |
|
1643
|
|
|
} else { |
|
1644
|
|
|
// Traverse its children |
|
1645
|
|
|
for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) { |
|
1646
|
|
|
ret += getText( elem ); |
|
1647
|
|
|
} |
|
1648
|
|
|
} |
|
1649
|
|
|
} else if ( nodeType === 3 || nodeType === 4 ) { |
|
1650
|
|
|
return elem.nodeValue; |
|
1651
|
|
|
} |
|
1652
|
|
|
// Do not include comment or processing instruction nodes |
|
1653
|
|
|
|
|
1654
|
|
|
return ret; |
|
1655
|
|
|
}; |
|
1656
|
|
|
|
|
1657
|
|
|
Expr = Sizzle.selectors = { |
|
1658
|
|
|
|
|
1659
|
|
|
// Can be adjusted by the user |
|
1660
|
|
|
cacheLength: 50, |
|
1661
|
|
|
|
|
1662
|
|
|
createPseudo: markFunction, |
|
1663
|
|
|
|
|
1664
|
|
|
match: matchExpr, |
|
1665
|
|
|
|
|
1666
|
|
|
attrHandle: {}, |
|
1667
|
|
|
|
|
1668
|
|
|
find: {}, |
|
1669
|
|
|
|
|
1670
|
|
|
relative: { |
|
1671
|
|
|
">": { dir: "parentNode", first: true }, |
|
1672
|
|
|
" ": { dir: "parentNode" }, |
|
1673
|
|
|
"+": { dir: "previousSibling", first: true }, |
|
1674
|
|
|
"~": { dir: "previousSibling" } |
|
1675
|
|
|
}, |
|
1676
|
|
|
|
|
1677
|
|
|
preFilter: { |
|
1678
|
|
|
"ATTR": function( match ) { |
|
1679
|
|
|
match[1] = match[1].replace( runescape, funescape ); |
|
1680
|
|
|
|
|
1681
|
|
|
// Move the given value to match[3] whether quoted or unquoted |
|
1682
|
|
|
match[3] = ( match[3] || match[4] || match[5] || "" ).replace( runescape, funescape ); |
|
1683
|
|
|
|
|
1684
|
|
|
if ( match[2] === "~=" ) { |
|
1685
|
|
|
match[3] = " " + match[3] + " "; |
|
1686
|
|
|
} |
|
1687
|
|
|
|
|
1688
|
|
|
return match.slice( 0, 4 ); |
|
1689
|
|
|
}, |
|
1690
|
|
|
|
|
1691
|
|
|
"CHILD": function( match ) { |
|
1692
|
|
|
/* matches from matchExpr["CHILD"] |
|
1693
|
|
|
1 type (only|nth|...) |
|
1694
|
|
|
2 what (child|of-type) |
|
1695
|
|
|
3 argument (even|odd|\d*|\d*n([+-]\d+)?|...) |
|
1696
|
|
|
4 xn-component of xn+y argument ([+-]?\d*n|) |
|
1697
|
|
|
5 sign of xn-component |
|
1698
|
|
|
6 x of xn-component |
|
1699
|
|
|
7 sign of y-component |
|
1700
|
|
|
8 y of y-component |
|
1701
|
|
|
*/ |
|
1702
|
|
|
match[1] = match[1].toLowerCase(); |
|
1703
|
|
|
|
|
1704
|
|
|
if ( match[1].slice( 0, 3 ) === "nth" ) { |
|
1705
|
|
|
// nth-* requires argument |
|
1706
|
|
|
if ( !match[3] ) { |
|
1707
|
|
|
Sizzle.error( match[0] ); |
|
1708
|
|
|
} |
|
1709
|
|
|
|
|
1710
|
|
|
// numeric x and y parameters for Expr.filter.CHILD |
|
1711
|
|
|
// remember that false/true cast respectively to 0/1 |
|
1712
|
|
|
match[4] = +( match[4] ? match[5] + (match[6] || 1) : 2 * ( match[3] === "even" || match[3] === "odd" ) ); |
|
1713
|
|
|
match[5] = +( ( match[7] + match[8] ) || match[3] === "odd" ); |
|
1714
|
|
|
|
|
1715
|
|
|
// other types prohibit arguments |
|
1716
|
|
|
} else if ( match[3] ) { |
|
1717
|
|
|
Sizzle.error( match[0] ); |
|
1718
|
|
|
} |
|
1719
|
|
|
|
|
1720
|
|
|
return match; |
|
1721
|
|
|
}, |
|
1722
|
|
|
|
|
1723
|
|
|
"PSEUDO": function( match ) { |
|
1724
|
|
|
var excess, |
|
1725
|
|
|
unquoted = !match[6] && match[2]; |
|
1726
|
|
|
|
|
1727
|
|
|
if ( matchExpr["CHILD"].test( match[0] ) ) { |
|
1728
|
|
|
return null; |
|
1729
|
|
|
} |
|
1730
|
|
|
|
|
1731
|
|
|
// Accept quoted arguments as-is |
|
1732
|
|
|
if ( match[3] ) { |
|
1733
|
|
|
match[2] = match[4] || match[5] || ""; |
|
1734
|
|
|
|
|
1735
|
|
|
// Strip excess characters from unquoted arguments |
|
1736
|
|
|
} else if ( unquoted && rpseudo.test( unquoted ) && |
|
1737
|
|
|
// Get excess from tokenize (recursively) |
|
1738
|
|
|
(excess = tokenize( unquoted, true )) && |
|
1739
|
|
|
// advance to the next closing parenthesis |
|
1740
|
|
|
(excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) { |
|
1741
|
|
|
|
|
1742
|
|
|
// excess is a negative index |
|
1743
|
|
|
match[0] = match[0].slice( 0, excess ); |
|
1744
|
|
|
match[2] = unquoted.slice( 0, excess ); |
|
1745
|
|
|
} |
|
1746
|
|
|
|
|
1747
|
|
|
// Return only captures needed by the pseudo filter method (type and argument) |
|
1748
|
|
|
return match.slice( 0, 3 ); |
|
1749
|
|
|
} |
|
1750
|
|
|
}, |
|
1751
|
|
|
|
|
1752
|
|
|
filter: { |
|
1753
|
|
|
|
|
1754
|
|
|
"TAG": function( nodeNameSelector ) { |
|
1755
|
|
|
var nodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase(); |
|
1756
|
|
|
return nodeNameSelector === "*" ? |
|
1757
|
|
|
function() { return true; } : |
|
1758
|
|
|
function( elem ) { |
|
1759
|
|
|
return elem.nodeName && elem.nodeName.toLowerCase() === nodeName; |
|
1760
|
|
|
}; |
|
1761
|
|
|
}, |
|
1762
|
|
|
|
|
1763
|
|
|
"CLASS": function( className ) { |
|
1764
|
|
|
var pattern = classCache[ className + " " ]; |
|
1765
|
|
|
|
|
1766
|
|
|
return pattern || |
|
1767
|
|
|
(pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) && |
|
1768
|
|
|
classCache( className, function( elem ) { |
|
1769
|
|
|
return pattern.test( typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== "undefined" && elem.getAttribute("class") || "" ); |
|
1770
|
|
|
}); |
|
1771
|
|
|
}, |
|
1772
|
|
|
|
|
1773
|
|
|
"ATTR": function( name, operator, check ) { |
|
1774
|
|
|
return function( elem ) { |
|
1775
|
|
|
var result = Sizzle.attr( elem, name ); |
|
1776
|
|
|
|
|
1777
|
|
|
if ( result == null ) { |
|
1778
|
|
|
return operator === "!="; |
|
1779
|
|
|
} |
|
1780
|
|
|
if ( !operator ) { |
|
1781
|
|
|
return true; |
|
1782
|
|
|
} |
|
1783
|
|
|
|
|
1784
|
|
|
result += ""; |
|
1785
|
|
|
|
|
1786
|
|
|
return operator === "=" ? result === check : |
|
1787
|
|
|
operator === "!=" ? result !== check : |
|
1788
|
|
|
operator === "^=" ? check && result.indexOf( check ) === 0 : |
|
1789
|
|
|
operator === "*=" ? check && result.indexOf( check ) > -1 : |
|
1790
|
|
|
operator === "$=" ? check && result.slice( -check.length ) === check : |
|
1791
|
|
|
operator === "~=" ? ( " " + result.replace( rwhitespace, " " ) + " " ).indexOf( check ) > -1 : |
|
1792
|
|
|
operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" : |
|
1793
|
|
|
false; |
|
1794
|
|
|
}; |
|
1795
|
|
|
}, |
|
1796
|
|
|
|
|
1797
|
|
|
"CHILD": function( type, what, argument, first, last ) { |
|
1798
|
|
|
var simple = type.slice( 0, 3 ) !== "nth", |
|
1799
|
|
|
forward = type.slice( -4 ) !== "last", |
|
1800
|
|
|
ofType = what === "of-type"; |
|
1801
|
|
|
|
|
1802
|
|
|
return first === 1 && last === 0 ? |
|
1803
|
|
|
|
|
1804
|
|
|
// Shortcut for :nth-*(n) |
|
1805
|
|
|
function( elem ) { |
|
1806
|
|
|
return !!elem.parentNode; |
|
1807
|
|
|
} : |
|
1808
|
|
|
|
|
1809
|
|
|
function( elem, context, xml ) { |
|
1810
|
|
|
var cache, uniqueCache, outerCache, node, nodeIndex, start, |
|
1811
|
|
|
dir = simple !== forward ? "nextSibling" : "previousSibling", |
|
1812
|
|
|
parent = elem.parentNode, |
|
1813
|
|
|
name = ofType && elem.nodeName.toLowerCase(), |
|
1814
|
|
|
useCache = !xml && !ofType, |
|
1815
|
|
|
diff = false; |
|
1816
|
|
|
|
|
1817
|
|
|
if ( parent ) { |
|
1818
|
|
|
|
|
1819
|
|
|
// :(first|last|only)-(child|of-type) |
|
1820
|
|
|
if ( simple ) { |
|
1821
|
|
|
while ( dir ) { |
|
1822
|
|
|
node = elem; |
|
1823
|
|
|
while ( (node = node[ dir ]) ) { |
|
1824
|
|
|
if ( ofType ? |
|
1825
|
|
|
node.nodeName.toLowerCase() === name : |
|
1826
|
|
|
node.nodeType === 1 ) { |
|
1827
|
|
|
|
|
1828
|
|
|
return false; |
|
1829
|
|
|
} |
|
1830
|
|
|
} |
|
1831
|
|
|
// Reverse direction for :only-* (if we haven't yet done so) |
|
1832
|
|
|
start = dir = type === "only" && !start && "nextSibling"; |
|
1833
|
|
|
} |
|
1834
|
|
|
return true; |
|
1835
|
|
|
} |
|
1836
|
|
|
|
|
1837
|
|
|
start = [ forward ? parent.firstChild : parent.lastChild ]; |
|
1838
|
|
|
|
|
1839
|
|
|
// non-xml :nth-child(...) stores cache data on `parent` |
|
1840
|
|
|
if ( forward && useCache ) { |
|
1841
|
|
|
|
|
1842
|
|
|
// Seek `elem` from a previously-cached index |
|
1843
|
|
|
|
|
1844
|
|
|
// ...in a gzip-friendly way |
|
1845
|
|
|
node = parent; |
|
1846
|
|
|
outerCache = node[ expando ] || (node[ expando ] = {}); |
|
1847
|
|
|
|
|
1848
|
|
|
// Support: IE <9 only |
|
1849
|
|
|
// Defend against cloned attroperties (jQuery gh-1709) |
|
1850
|
|
|
uniqueCache = outerCache[ node.uniqueID ] || |
|
1851
|
|
|
(outerCache[ node.uniqueID ] = {}); |
|
1852
|
|
|
|
|
1853
|
|
|
cache = uniqueCache[ type ] || []; |
|
1854
|
|
|
nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ]; |
|
1855
|
|
|
diff = nodeIndex && cache[ 2 ]; |
|
1856
|
|
|
node = nodeIndex && parent.childNodes[ nodeIndex ]; |
|
1857
|
|
|
|
|
1858
|
|
|
while ( (node = ++nodeIndex && node && node[ dir ] || |
|
1859
|
|
|
|
|
1860
|
|
|
// Fallback to seeking `elem` from the start |
|
1861
|
|
|
(diff = nodeIndex = 0) || start.pop()) ) { |
|
1862
|
|
|
|
|
1863
|
|
|
// When found, cache indexes on `parent` and break |
|
1864
|
|
|
if ( node.nodeType === 1 && ++diff && node === elem ) { |
|
1865
|
|
|
uniqueCache[ type ] = [ dirruns, nodeIndex, diff ]; |
|
1866
|
|
|
break; |
|
1867
|
|
|
} |
|
1868
|
|
|
} |
|
1869
|
|
|
|
|
1870
|
|
|
} else { |
|
1871
|
|
|
// Use previously-cached element index if available |
|
1872
|
|
|
if ( useCache ) { |
|
1873
|
|
|
// ...in a gzip-friendly way |
|
1874
|
|
|
node = elem; |
|
1875
|
|
|
outerCache = node[ expando ] || (node[ expando ] = {}); |
|
1876
|
|
|
|
|
1877
|
|
|
// Support: IE <9 only |
|
1878
|
|
|
// Defend against cloned attroperties (jQuery gh-1709) |
|
1879
|
|
|
uniqueCache = outerCache[ node.uniqueID ] || |
|
1880
|
|
|
(outerCache[ node.uniqueID ] = {}); |
|
1881
|
|
|
|
|
1882
|
|
|
cache = uniqueCache[ type ] || []; |
|
1883
|
|
|
nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ]; |
|
1884
|
|
|
diff = nodeIndex; |
|
1885
|
|
|
} |
|
1886
|
|
|
|
|
1887
|
|
|
// xml :nth-child(...) |
|
1888
|
|
|
// or :nth-last-child(...) or :nth(-last)?-of-type(...) |
|
1889
|
|
|
if ( diff === false ) { |
|
1890
|
|
|
// Use the same loop as above to seek `elem` from the start |
|
1891
|
|
|
while ( (node = ++nodeIndex && node && node[ dir ] || |
|
1892
|
|
|
(diff = nodeIndex = 0) || start.pop()) ) { |
|
1893
|
|
|
|
|
1894
|
|
|
if ( ( ofType ? |
|
1895
|
|
|
node.nodeName.toLowerCase() === name : |
|
1896
|
|
|
node.nodeType === 1 ) && |
|
1897
|
|
|
++diff ) { |
|
1898
|
|
|
|
|
1899
|
|
|
// Cache the index of each encountered element |
|
1900
|
|
|
if ( useCache ) { |
|
1901
|
|
|
outerCache = node[ expando ] || (node[ expando ] = {}); |
|
1902
|
|
|
|
|
1903
|
|
|
// Support: IE <9 only |
|
1904
|
|
|
// Defend against cloned attroperties (jQuery gh-1709) |
|
1905
|
|
|
uniqueCache = outerCache[ node.uniqueID ] || |
|
1906
|
|
|
(outerCache[ node.uniqueID ] = {}); |
|
1907
|
|
|
|
|
1908
|
|
|
uniqueCache[ type ] = [ dirruns, diff ]; |
|
1909
|
|
|
} |
|
1910
|
|
|
|
|
1911
|
|
|
if ( node === elem ) { |
|
1912
|
|
|
break; |
|
1913
|
|
|
} |
|
1914
|
|
|
} |
|
1915
|
|
|
} |
|
1916
|
|
|
} |
|
1917
|
|
|
} |
|
1918
|
|
|
|
|
1919
|
|
|
// Incorporate the offset, then check against cycle size |
|
1920
|
|
|
diff -= last; |
|
1921
|
|
|
return diff === first || ( diff % first === 0 && diff / first >= 0 ); |
|
1922
|
|
|
} |
|
1923
|
|
|
}; |
|
1924
|
|
|
}, |
|
1925
|
|
|
|
|
1926
|
|
|
"PSEUDO": function( pseudo, argument ) { |
|
1927
|
|
|
// pseudo-class names are case-insensitive |
|
1928
|
|
|
// http://www.w3.org/TR/selectors/#pseudo-classes |
|
1929
|
|
|
// Prioritize by case sensitivity in case custom pseudos are added with uppercase letters |
|
1930
|
|
|
// Remember that setFilters inherits from pseudos |
|
1931
|
|
|
var args, |
|
1932
|
|
|
fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] || |
|
1933
|
|
|
Sizzle.error( "unsupported pseudo: " + pseudo ); |
|
1934
|
|
|
|
|
1935
|
|
|
// The user may use createPseudo to indicate that |
|
1936
|
|
|
// arguments are needed to create the filter function |
|
1937
|
|
|
// just as Sizzle does |
|
1938
|
|
|
if ( fn[ expando ] ) { |
|
1939
|
|
|
return fn( argument ); |
|
1940
|
|
|
} |
|
1941
|
|
|
|
|
1942
|
|
|
// But maintain support for old signatures |
|
1943
|
|
|
if ( fn.length > 1 ) { |
|
1944
|
|
|
args = [ pseudo, pseudo, "", argument ]; |
|
1945
|
|
|
return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ? |
|
1946
|
|
|
markFunction(function( seed, matches ) { |
|
1947
|
|
|
var idx, |
|
1948
|
|
|
matched = fn( seed, argument ), |
|
1949
|
|
|
i = matched.length; |
|
1950
|
|
|
while ( i-- ) { |
|
1951
|
|
|
idx = indexOf( seed, matched[i] ); |
|
1952
|
|
|
seed[ idx ] = !( matches[ idx ] = matched[i] ); |
|
1953
|
|
|
} |
|
1954
|
|
|
}) : |
|
1955
|
|
|
function( elem ) { |
|
1956
|
|
|
return fn( elem, 0, args ); |
|
1957
|
|
|
}; |
|
1958
|
|
|
} |
|
1959
|
|
|
|
|
1960
|
|
|
return fn; |
|
1961
|
|
|
} |
|
1962
|
|
|
}, |
|
1963
|
|
|
|
|
1964
|
|
|
pseudos: { |
|
1965
|
|
|
// Potentially complex pseudos |
|
1966
|
|
|
"not": markFunction(function( selector ) { |
|
1967
|
|
|
// Trim the selector passed to compile |
|
1968
|
|
|
// to avoid treating leading and trailing |
|
1969
|
|
|
// spaces as combinators |
|
1970
|
|
|
var input = [], |
|
1971
|
|
|
results = [], |
|
1972
|
|
|
matcher = compile( selector.replace( rtrim, "$1" ) ); |
|
1973
|
|
|
|
|
1974
|
|
|
return matcher[ expando ] ? |
|
1975
|
|
|
markFunction(function( seed, matches, context, xml ) { |
|
1976
|
|
|
var elem, |
|
1977
|
|
|
unmatched = matcher( seed, null, xml, [] ), |
|
1978
|
|
|
i = seed.length; |
|
1979
|
|
|
|
|
1980
|
|
|
// Match elements unmatched by `matcher` |
|
1981
|
|
|
while ( i-- ) { |
|
1982
|
|
|
if ( (elem = unmatched[i]) ) { |
|
1983
|
|
|
seed[i] = !(matches[i] = elem); |
|
1984
|
|
|
} |
|
1985
|
|
|
} |
|
1986
|
|
|
}) : |
|
1987
|
|
|
function( elem, context, xml ) { |
|
1988
|
|
|
input[0] = elem; |
|
1989
|
|
|
matcher( input, null, xml, results ); |
|
1990
|
|
|
// Don't keep the element (issue #299) |
|
1991
|
|
|
input[0] = null; |
|
1992
|
|
|
return !results.pop(); |
|
1993
|
|
|
}; |
|
1994
|
|
|
}), |
|
1995
|
|
|
|
|
1996
|
|
|
"has": markFunction(function( selector ) { |
|
1997
|
|
|
return function( elem ) { |
|
1998
|
|
|
return Sizzle( selector, elem ).length > 0; |
|
1999
|
|
|
}; |
|
2000
|
|
|
}), |
|
2001
|
|
|
|
|
2002
|
|
|
"contains": markFunction(function( text ) { |
|
2003
|
|
|
text = text.replace( runescape, funescape ); |
|
2004
|
|
|
return function( elem ) { |
|
2005
|
|
|
return ( elem.textContent || elem.innerText || getText( elem ) ).indexOf( text ) > -1; |
|
2006
|
|
|
}; |
|
2007
|
|
|
}), |
|
2008
|
|
|
|
|
2009
|
|
|
// "Whether an element is represented by a :lang() selector |
|
2010
|
|
|
// is based solely on the element's language value |
|
2011
|
|
|
// being equal to the identifier C, |
|
2012
|
|
|
// or beginning with the identifier C immediately followed by "-". |
|
2013
|
|
|
// The matching of C against the element's language value is performed case-insensitively. |
|
2014
|
|
|
// The identifier C does not have to be a valid language name." |
|
2015
|
|
|
// http://www.w3.org/TR/selectors/#lang-pseudo |
|
2016
|
|
|
"lang": markFunction( function( lang ) { |
|
2017
|
|
|
// lang value must be a valid identifier |
|
2018
|
|
|
if ( !ridentifier.test(lang || "") ) { |
|
2019
|
|
|
Sizzle.error( "unsupported lang: " + lang ); |
|
2020
|
|
|
} |
|
2021
|
|
|
lang = lang.replace( runescape, funescape ).toLowerCase(); |
|
2022
|
|
|
return function( elem ) { |
|
2023
|
|
|
var elemLang; |
|
2024
|
|
|
do { |
|
2025
|
|
|
if ( (elemLang = documentIsHTML ? |
|
2026
|
|
|
elem.lang : |
|
2027
|
|
|
elem.getAttribute("xml:lang") || elem.getAttribute("lang")) ) { |
|
2028
|
|
|
|
|
2029
|
|
|
elemLang = elemLang.toLowerCase(); |
|
2030
|
|
|
return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0; |
|
2031
|
|
|
} |
|
2032
|
|
|
} while ( (elem = elem.parentNode) && elem.nodeType === 1 ); |
|
2033
|
|
|
return false; |
|
2034
|
|
|
}; |
|
2035
|
|
|
}), |
|
2036
|
|
|
|
|
2037
|
|
|
// Miscellaneous |
|
2038
|
|
|
"target": function( elem ) { |
|
2039
|
|
|
var hash = window.location && window.location.hash; |
|
2040
|
|
|
return hash && hash.slice( 1 ) === elem.id; |
|
2041
|
|
|
}, |
|
2042
|
|
|
|
|
2043
|
|
|
"root": function( elem ) { |
|
2044
|
|
|
return elem === docElem; |
|
2045
|
|
|
}, |
|
2046
|
|
|
|
|
2047
|
|
|
"focus": function( elem ) { |
|
2048
|
|
|
return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex); |
|
2049
|
|
|
}, |
|
2050
|
|
|
|
|
2051
|
|
|
// Boolean properties |
|
2052
|
|
|
"enabled": createDisabledPseudo( false ), |
|
2053
|
|
|
"disabled": createDisabledPseudo( true ), |
|
2054
|
|
|
|
|
2055
|
|
|
"checked": function( elem ) { |
|
2056
|
|
|
// In CSS3, :checked should return both checked and selected elements |
|
2057
|
|
|
// http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked |
|
2058
|
|
|
var nodeName = elem.nodeName.toLowerCase(); |
|
2059
|
|
|
return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected); |
|
2060
|
|
|
}, |
|
2061
|
|
|
|
|
2062
|
|
|
"selected": function( elem ) { |
|
2063
|
|
|
// Accessing this property makes selected-by-default |
|
2064
|
|
|
// options in Safari work properly |
|
2065
|
|
|
if ( elem.parentNode ) { |
|
2066
|
|
|
elem.parentNode.selectedIndex; |
|
2067
|
|
|
} |
|
2068
|
|
|
|
|
2069
|
|
|
return elem.selected === true; |
|
2070
|
|
|
}, |
|
2071
|
|
|
|
|
2072
|
|
|
// Contents |
|
2073
|
|
|
"empty": function( elem ) { |
|
2074
|
|
|
// http://www.w3.org/TR/selectors/#empty-pseudo |
|
2075
|
|
|
// :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5), |
|
2076
|
|
|
// but not by others (comment: 8; processing instruction: 7; etc.) |
|
2077
|
|
|
// nodeType < 6 works because attributes (2) do not appear as children |
|
2078
|
|
|
for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) { |
|
2079
|
|
|
if ( elem.nodeType < 6 ) { |
|
2080
|
|
|
return false; |
|
2081
|
|
|
} |
|
2082
|
|
|
} |
|
2083
|
|
|
return true; |
|
2084
|
|
|
}, |
|
2085
|
|
|
|
|
2086
|
|
|
"parent": function( elem ) { |
|
2087
|
|
|
return !Expr.pseudos["empty"]( elem ); |
|
2088
|
|
|
}, |
|
2089
|
|
|
|
|
2090
|
|
|
// Element/input types |
|
2091
|
|
|
"header": function( elem ) { |
|
2092
|
|
|
return rheader.test( elem.nodeName ); |
|
2093
|
|
|
}, |
|
2094
|
|
|
|
|
2095
|
|
|
"input": function( elem ) { |
|
2096
|
|
|
return rinputs.test( elem.nodeName ); |
|
2097
|
|
|
}, |
|
2098
|
|
|
|
|
2099
|
|
|
"button": function( elem ) { |
|
2100
|
|
|
var name = elem.nodeName.toLowerCase(); |
|
2101
|
|
|
return name === "input" && elem.type === "button" || name === "button"; |
|
2102
|
|
|
}, |
|
2103
|
|
|
|
|
2104
|
|
|
"text": function( elem ) { |
|
2105
|
|
|
var attr; |
|
2106
|
|
|
return elem.nodeName.toLowerCase() === "input" && |
|
2107
|
|
|
elem.type === "text" && |
|
2108
|
|
|
|
|
2109
|
|
|
// Support: IE<8 |
|
2110
|
|
|
// New HTML5 attribute values (e.g., "search") appear with elem.type === "text" |
|
2111
|
|
|
( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === "text" ); |
|
2112
|
|
|
}, |
|
2113
|
|
|
|
|
2114
|
|
|
// Position-in-collection |
|
2115
|
|
|
"first": createPositionalPseudo(function() { |
|
2116
|
|
|
return [ 0 ]; |
|
2117
|
|
|
}), |
|
2118
|
|
|
|
|
2119
|
|
|
"last": createPositionalPseudo(function( matchIndexes, length ) { |
|
2120
|
|
|
return [ length - 1 ]; |
|
2121
|
|
|
}), |
|
2122
|
|
|
|
|
2123
|
|
|
"eq": createPositionalPseudo(function( matchIndexes, length, argument ) { |
|
2124
|
|
|
return [ argument < 0 ? argument + length : argument ]; |
|
2125
|
|
|
}), |
|
2126
|
|
|
|
|
2127
|
|
|
"even": createPositionalPseudo(function( matchIndexes, length ) { |
|
2128
|
|
|
var i = 0; |
|
2129
|
|
|
for ( ; i < length; i += 2 ) { |
|
2130
|
|
|
matchIndexes.push( i ); |
|
2131
|
|
|
} |
|
2132
|
|
|
return matchIndexes; |
|
2133
|
|
|
}), |
|
2134
|
|
|
|
|
2135
|
|
|
"odd": createPositionalPseudo(function( matchIndexes, length ) { |
|
2136
|
|
|
var i = 1; |
|
2137
|
|
|
for ( ; i < length; i += 2 ) { |
|
2138
|
|
|
matchIndexes.push( i ); |
|
2139
|
|
|
} |
|
2140
|
|
|
return matchIndexes; |
|
2141
|
|
|
}), |
|
2142
|
|
|
|
|
2143
|
|
|
"lt": createPositionalPseudo(function( matchIndexes, length, argument ) { |
|
2144
|
|
|
var i = argument < 0 ? argument + length : argument; |
|
2145
|
|
|
for ( ; --i >= 0; ) { |
|
2146
|
|
|
matchIndexes.push( i ); |
|
2147
|
|
|
} |
|
2148
|
|
|
return matchIndexes; |
|
2149
|
|
|
}), |
|
2150
|
|
|
|
|
2151
|
|
|
"gt": createPositionalPseudo(function( matchIndexes, length, argument ) { |
|
2152
|
|
|
var i = argument < 0 ? argument + length : argument; |
|
2153
|
|
|
for ( ; ++i < length; ) { |
|
2154
|
|
|
matchIndexes.push( i ); |
|
2155
|
|
|
} |
|
2156
|
|
|
return matchIndexes; |
|
2157
|
|
|
}) |
|
2158
|
|
|
} |
|
2159
|
|
|
}; |
|
2160
|
|
|
|
|
2161
|
|
|
Expr.pseudos["nth"] = Expr.pseudos["eq"]; |
|
2162
|
|
|
|
|
2163
|
|
|
// Add button/input type pseudos |
|
2164
|
|
|
for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) { |
|
2165
|
|
|
Expr.pseudos[ i ] = createInputPseudo( i ); |
|
2166
|
|
|
} |
|
2167
|
|
|
for ( i in { submit: true, reset: true } ) { |
|
2168
|
|
|
Expr.pseudos[ i ] = createButtonPseudo( i ); |
|
2169
|
|
|
} |
|
2170
|
|
|
|
|
2171
|
|
|
// Easy API for creating new setFilters |
|
2172
|
|
|
function setFilters() {} |
|
2173
|
|
|
setFilters.prototype = Expr.filters = Expr.pseudos; |
|
2174
|
|
|
Expr.setFilters = new setFilters(); |
|
2175
|
|
|
|
|
2176
|
|
|
tokenize = Sizzle.tokenize = function( selector, parseOnly ) { |
|
2177
|
|
|
var matched, match, tokens, type, |
|
2178
|
|
|
soFar, groups, preFilters, |
|
2179
|
|
|
cached = tokenCache[ selector + " " ]; |
|
2180
|
|
|
|
|
2181
|
|
|
if ( cached ) { |
|
2182
|
|
|
return parseOnly ? 0 : cached.slice( 0 ); |
|
2183
|
|
|
} |
|
2184
|
|
|
|
|
2185
|
|
|
soFar = selector; |
|
2186
|
|
|
groups = []; |
|
2187
|
|
|
preFilters = Expr.preFilter; |
|
2188
|
|
|
|
|
2189
|
|
|
while ( soFar ) { |
|
2190
|
|
|
|
|
2191
|
|
|
// Comma and first run |
|
2192
|
|
|
if ( !matched || (match = rcomma.exec( soFar )) ) { |
|
2193
|
|
|
if ( match ) { |
|
2194
|
|
|
// Don't consume trailing commas as valid |
|
2195
|
|
|
soFar = soFar.slice( match[0].length ) || soFar; |
|
2196
|
|
|
} |
|
2197
|
|
|
groups.push( (tokens = []) ); |
|
2198
|
|
|
} |
|
2199
|
|
|
|
|
2200
|
|
|
matched = false; |
|
2201
|
|
|
|
|
2202
|
|
|
// Combinators |
|
2203
|
|
|
if ( (match = rcombinators.exec( soFar )) ) { |
|
2204
|
|
|
matched = match.shift(); |
|
2205
|
|
|
tokens.push({ |
|
2206
|
|
|
value: matched, |
|
2207
|
|
|
// Cast descendant combinators to space |
|
2208
|
|
|
type: match[0].replace( rtrim, " " ) |
|
2209
|
|
|
}); |
|
2210
|
|
|
soFar = soFar.slice( matched.length ); |
|
2211
|
|
|
} |
|
2212
|
|
|
|
|
2213
|
|
|
// Filters |
|
2214
|
|
|
for ( type in Expr.filter ) { |
|
2215
|
|
|
if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] || |
|
2216
|
|
|
(match = preFilters[ type ]( match ))) ) { |
|
2217
|
|
|
matched = match.shift(); |
|
2218
|
|
|
tokens.push({ |
|
2219
|
|
|
value: matched, |
|
2220
|
|
|
type: type, |
|
2221
|
|
|
matches: match |
|
2222
|
|
|
}); |
|
2223
|
|
|
soFar = soFar.slice( matched.length ); |
|
2224
|
|
|
} |
|
2225
|
|
|
} |
|
2226
|
|
|
|
|
2227
|
|
|
if ( !matched ) { |
|
2228
|
|
|
break; |
|
2229
|
|
|
} |
|
2230
|
|
|
} |
|
2231
|
|
|
|
|
2232
|
|
|
// Return the length of the invalid excess |
|
2233
|
|
|
// if we're just parsing |
|
2234
|
|
|
// Otherwise, throw an error or return tokens |
|
2235
|
|
|
return parseOnly ? |
|
2236
|
|
|
soFar.length : |
|
2237
|
|
|
soFar ? |
|
2238
|
|
|
Sizzle.error( selector ) : |
|
2239
|
|
|
// Cache the tokens |
|
2240
|
|
|
tokenCache( selector, groups ).slice( 0 ); |
|
2241
|
|
|
}; |
|
2242
|
|
|
|
|
2243
|
|
|
function toSelector( tokens ) { |
|
2244
|
|
|
var i = 0, |
|
2245
|
|
|
len = tokens.length, |
|
2246
|
|
|
selector = ""; |
|
2247
|
|
|
for ( ; i < len; i++ ) { |
|
2248
|
|
|
selector += tokens[i].value; |
|
2249
|
|
|
} |
|
2250
|
|
|
return selector; |
|
2251
|
|
|
} |
|
2252
|
|
|
|
|
2253
|
|
|
function addCombinator( matcher, combinator, base ) { |
|
2254
|
|
|
var dir = combinator.dir, |
|
2255
|
|
|
skip = combinator.next, |
|
2256
|
|
|
key = skip || dir, |
|
2257
|
|
|
checkNonElements = base && key === "parentNode", |
|
2258
|
|
|
doneName = done++; |
|
2259
|
|
|
|
|
2260
|
|
|
return combinator.first ? |
|
2261
|
|
|
// Check against closest ancestor/preceding element |
|
2262
|
|
|
function( elem, context, xml ) { |
|
2263
|
|
|
while ( (elem = elem[ dir ]) ) { |
|
2264
|
|
|
if ( elem.nodeType === 1 || checkNonElements ) { |
|
2265
|
|
|
return matcher( elem, context, xml ); |
|
2266
|
|
|
} |
|
2267
|
|
|
} |
|
2268
|
|
|
return false; |
|
2269
|
|
|
} : |
|
2270
|
|
|
|
|
2271
|
|
|
// Check against all ancestor/preceding elements |
|
2272
|
|
|
function( elem, context, xml ) { |
|
2273
|
|
|
var oldCache, uniqueCache, outerCache, |
|
2274
|
|
|
newCache = [ dirruns, doneName ]; |
|
2275
|
|
|
|
|
2276
|
|
|
// We can't set arbitrary data on XML nodes, so they don't benefit from combinator caching |
|
2277
|
|
|
if ( xml ) { |
|
2278
|
|
|
while ( (elem = elem[ dir ]) ) { |
|
2279
|
|
|
if ( elem.nodeType === 1 || checkNonElements ) { |
|
2280
|
|
|
if ( matcher( elem, context, xml ) ) { |
|
2281
|
|
|
return true; |
|
2282
|
|
|
} |
|
2283
|
|
|
} |
|
2284
|
|
|
} |
|
2285
|
|
|
} else { |
|
2286
|
|
|
while ( (elem = elem[ dir ]) ) { |
|
2287
|
|
|
if ( elem.nodeType === 1 || checkNonElements ) { |
|
2288
|
|
|
outerCache = elem[ expando ] || (elem[ expando ] = {}); |
|
2289
|
|
|
|
|
2290
|
|
|
// Support: IE <9 only |
|
2291
|
|
|
// Defend against cloned attroperties (jQuery gh-1709) |
|
2292
|
|
|
uniqueCache = outerCache[ elem.uniqueID ] || (outerCache[ elem.uniqueID ] = {}); |
|
2293
|
|
|
|
|
2294
|
|
|
if ( skip && skip === elem.nodeName.toLowerCase() ) { |
|
2295
|
|
|
elem = elem[ dir ] || elem; |
|
2296
|
|
|
} else if ( (oldCache = uniqueCache[ key ]) && |
|
2297
|
|
|
oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) { |
|
2298
|
|
|
|
|
2299
|
|
|
// Assign to newCache so results back-propagate to previous elements |
|
2300
|
|
|
return (newCache[ 2 ] = oldCache[ 2 ]); |
|
2301
|
|
|
} else { |
|
2302
|
|
|
// Reuse newcache so results back-propagate to previous elements |
|
2303
|
|
|
uniqueCache[ key ] = newCache; |
|
2304
|
|
|
|
|
2305
|
|
|
// A match means we're done; a fail means we have to keep checking |
|
2306
|
|
|
if ( (newCache[ 2 ] = matcher( elem, context, xml )) ) { |
|
2307
|
|
|
return true; |
|
2308
|
|
|
} |
|
2309
|
|
|
} |
|
2310
|
|
|
} |
|
2311
|
|
|
} |
|
2312
|
|
|
} |
|
2313
|
|
|
return false; |
|
2314
|
|
|
}; |
|
2315
|
|
|
} |
|
2316
|
|
|
|
|
2317
|
|
|
function elementMatcher( matchers ) { |
|
2318
|
|
|
return matchers.length > 1 ? |
|
2319
|
|
|
function( elem, context, xml ) { |
|
2320
|
|
|
var i = matchers.length; |
|
2321
|
|
|
while ( i-- ) { |
|
2322
|
|
|
if ( !matchers[i]( elem, context, xml ) ) { |
|
2323
|
|
|
return false; |
|
2324
|
|
|
} |
|
2325
|
|
|
} |
|
2326
|
|
|
return true; |
|
2327
|
|
|
} : |
|
2328
|
|
|
matchers[0]; |
|
2329
|
|
|
} |
|
2330
|
|
|
|
|
2331
|
|
|
function multipleContexts( selector, contexts, results ) { |
|
2332
|
|
|
var i = 0, |
|
2333
|
|
|
len = contexts.length; |
|
2334
|
|
|
for ( ; i < len; i++ ) { |
|
2335
|
|
|
Sizzle( selector, contexts[i], results ); |
|
2336
|
|
|
} |
|
2337
|
|
|
return results; |
|
2338
|
|
|
} |
|
2339
|
|
|
|
|
2340
|
|
|
function condense( unmatched, map, filter, context, xml ) { |
|
2341
|
|
|
var elem, |
|
2342
|
|
|
newUnmatched = [], |
|
2343
|
|
|
i = 0, |
|
2344
|
|
|
len = unmatched.length, |
|
2345
|
|
|
mapped = map != null; |
|
2346
|
|
|
|
|
2347
|
|
|
for ( ; i < len; i++ ) { |
|
2348
|
|
|
if ( (elem = unmatched[i]) ) { |
|
2349
|
|
|
if ( !filter || filter( elem, context, xml ) ) { |
|
2350
|
|
|
newUnmatched.push( elem ); |
|
2351
|
|
|
if ( mapped ) { |
|
2352
|
|
|
map.push( i ); |
|
2353
|
|
|
} |
|
2354
|
|
|
} |
|
2355
|
|
|
} |
|
2356
|
|
|
} |
|
2357
|
|
|
|
|
2358
|
|
|
return newUnmatched; |
|
2359
|
|
|
} |
|
2360
|
|
|
|
|
2361
|
|
|
function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) { |
|
2362
|
|
|
if ( postFilter && !postFilter[ expando ] ) { |
|
2363
|
|
|
postFilter = setMatcher( postFilter ); |
|
2364
|
|
|
} |
|
2365
|
|
|
if ( postFinder && !postFinder[ expando ] ) { |
|
2366
|
|
|
postFinder = setMatcher( postFinder, postSelector ); |
|
2367
|
|
|
} |
|
2368
|
|
|
return markFunction(function( seed, results, context, xml ) { |
|
2369
|
|
|
var temp, i, elem, |
|
2370
|
|
|
preMap = [], |
|
2371
|
|
|
postMap = [], |
|
2372
|
|
|
preexisting = results.length, |
|
2373
|
|
|
|
|
2374
|
|
|
// Get initial elements from seed or context |
|
2375
|
|
|
elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ), |
|
2376
|
|
|
|
|
2377
|
|
|
// Prefilter to get matcher input, preserving a map for seed-results synchronization |
|
2378
|
|
|
matcherIn = preFilter && ( seed || !selector ) ? |
|
2379
|
|
|
condense( elems, preMap, preFilter, context, xml ) : |
|
2380
|
|
|
elems, |
|
2381
|
|
|
|
|
2382
|
|
|
matcherOut = matcher ? |
|
2383
|
|
|
// If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results, |
|
2384
|
|
|
postFinder || ( seed ? preFilter : preexisting || postFilter ) ? |
|
2385
|
|
|
|
|
2386
|
|
|
// ...intermediate processing is necessary |
|
2387
|
|
|
[] : |
|
2388
|
|
|
|
|
2389
|
|
|
// ...otherwise use results directly |
|
2390
|
|
|
results : |
|
2391
|
|
|
matcherIn; |
|
2392
|
|
|
|
|
2393
|
|
|
// Find primary matches |
|
2394
|
|
|
if ( matcher ) { |
|
2395
|
|
|
matcher( matcherIn, matcherOut, context, xml ); |
|
2396
|
|
|
} |
|
2397
|
|
|
|
|
2398
|
|
|
// Apply postFilter |
|
2399
|
|
|
if ( postFilter ) { |
|
2400
|
|
|
temp = condense( matcherOut, postMap ); |
|
2401
|
|
|
postFilter( temp, [], context, xml ); |
|
2402
|
|
|
|
|
2403
|
|
|
// Un-match failing elements by moving them back to matcherIn |
|
2404
|
|
|
i = temp.length; |
|
2405
|
|
|
while ( i-- ) { |
|
2406
|
|
|
if ( (elem = temp[i]) ) { |
|
2407
|
|
|
matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem); |
|
2408
|
|
|
} |
|
2409
|
|
|
} |
|
2410
|
|
|
} |
|
2411
|
|
|
|
|
2412
|
|
|
if ( seed ) { |
|
2413
|
|
|
if ( postFinder || preFilter ) { |
|
2414
|
|
|
if ( postFinder ) { |
|
2415
|
|
|
// Get the final matcherOut by condensing this intermediate into postFinder contexts |
|
2416
|
|
|
temp = []; |
|
2417
|
|
|
i = matcherOut.length; |
|
2418
|
|
|
while ( i-- ) { |
|
2419
|
|
|
if ( (elem = matcherOut[i]) ) { |
|
2420
|
|
|
// Restore matcherIn since elem is not yet a final match |
|
2421
|
|
|
temp.push( (matcherIn[i] = elem) ); |
|
2422
|
|
|
} |
|
2423
|
|
|
} |
|
2424
|
|
|
postFinder( null, (matcherOut = []), temp, xml ); |
|
2425
|
|
|
} |
|
2426
|
|
|
|
|
2427
|
|
|
// Move matched elements from seed to results to keep them synchronized |
|
2428
|
|
|
i = matcherOut.length; |
|
2429
|
|
|
while ( i-- ) { |
|
2430
|
|
|
if ( (elem = matcherOut[i]) && |
|
2431
|
|
|
(temp = postFinder ? indexOf( seed, elem ) : preMap[i]) > -1 ) { |
|
2432
|
|
|
|
|
2433
|
|
|
seed[temp] = !(results[temp] = elem); |
|
2434
|
|
|
} |
|
2435
|
|
|
} |
|
2436
|
|
|
} |
|
2437
|
|
|
|
|
2438
|
|
|
// Add elements to results, through postFinder if defined |
|
2439
|
|
|
} else { |
|
2440
|
|
|
matcherOut = condense( |
|
2441
|
|
|
matcherOut === results ? |
|
2442
|
|
|
matcherOut.splice( preexisting, matcherOut.length ) : |
|
2443
|
|
|
matcherOut |
|
2444
|
|
|
); |
|
2445
|
|
|
if ( postFinder ) { |
|
2446
|
|
|
postFinder( null, results, matcherOut, xml ); |
|
2447
|
|
|
} else { |
|
2448
|
|
|
push.apply( results, matcherOut ); |
|
2449
|
|
|
} |
|
2450
|
|
|
} |
|
2451
|
|
|
}); |
|
2452
|
|
|
} |
|
2453
|
|
|
|
|
2454
|
|
|
function matcherFromTokens( tokens ) { |
|
2455
|
|
|
var checkContext, matcher, j, |
|
2456
|
|
|
len = tokens.length, |
|
2457
|
|
|
leadingRelative = Expr.relative[ tokens[0].type ], |
|
2458
|
|
|
implicitRelative = leadingRelative || Expr.relative[" "], |
|
2459
|
|
|
i = leadingRelative ? 1 : 0, |
|
2460
|
|
|
|
|
2461
|
|
|
// The foundational matcher ensures that elements are reachable from top-level context(s) |
|
2462
|
|
|
matchContext = addCombinator( function( elem ) { |
|
2463
|
|
|
return elem === checkContext; |
|
2464
|
|
|
}, implicitRelative, true ), |
|
2465
|
|
|
matchAnyContext = addCombinator( function( elem ) { |
|
2466
|
|
|
return indexOf( checkContext, elem ) > -1; |
|
2467
|
|
|
}, implicitRelative, true ), |
|
2468
|
|
|
matchers = [ function( elem, context, xml ) { |
|
2469
|
|
|
var ret = ( !leadingRelative && ( xml || context !== outermostContext ) ) || ( |
|
2470
|
|
|
(checkContext = context).nodeType ? |
|
2471
|
|
|
matchContext( elem, context, xml ) : |
|
2472
|
|
|
matchAnyContext( elem, context, xml ) ); |
|
2473
|
|
|
// Avoid hanging onto element (issue #299) |
|
2474
|
|
|
checkContext = null; |
|
2475
|
|
|
return ret; |
|
2476
|
|
|
} ]; |
|
2477
|
|
|
|
|
2478
|
|
|
for ( ; i < len; i++ ) { |
|
2479
|
|
|
if ( (matcher = Expr.relative[ tokens[i].type ]) ) { |
|
2480
|
|
|
matchers = [ addCombinator(elementMatcher( matchers ), matcher) ]; |
|
2481
|
|
|
} else { |
|
2482
|
|
|
matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches ); |
|
2483
|
|
|
|
|
2484
|
|
|
// Return special upon seeing a positional matcher |
|
2485
|
|
|
if ( matcher[ expando ] ) { |
|
2486
|
|
|
// Find the next relative operator (if any) for proper handling |
|
2487
|
|
|
j = ++i; |
|
2488
|
|
|
for ( ; j < len; j++ ) { |
|
2489
|
|
|
if ( Expr.relative[ tokens[j].type ] ) { |
|
2490
|
|
|
break; |
|
2491
|
|
|
} |
|
2492
|
|
|
} |
|
2493
|
|
|
return setMatcher( |
|
2494
|
|
|
i > 1 && elementMatcher( matchers ), |
|
2495
|
|
|
i > 1 && toSelector( |
|
2496
|
|
|
// If the preceding token was a descendant combinator, insert an implicit any-element `*` |
|
2497
|
|
|
tokens.slice( 0, i - 1 ).concat({ value: tokens[ i - 2 ].type === " " ? "*" : "" }) |
|
2498
|
|
|
).replace( rtrim, "$1" ), |
|
2499
|
|
|
matcher, |
|
2500
|
|
|
i < j && matcherFromTokens( tokens.slice( i, j ) ), |
|
2501
|
|
|
j < len && matcherFromTokens( (tokens = tokens.slice( j )) ), |
|
2502
|
|
|
j < len && toSelector( tokens ) |
|
2503
|
|
|
); |
|
2504
|
|
|
} |
|
2505
|
|
|
matchers.push( matcher ); |
|
2506
|
|
|
} |
|
2507
|
|
|
} |
|
2508
|
|
|
|
|
2509
|
|
|
return elementMatcher( matchers ); |
|
2510
|
|
|
} |
|
2511
|
|
|
|
|
2512
|
|
|
function matcherFromGroupMatchers( elementMatchers, setMatchers ) { |
|
2513
|
|
|
var bySet = setMatchers.length > 0, |
|
2514
|
|
|
byElement = elementMatchers.length > 0, |
|
2515
|
|
|
superMatcher = function( seed, context, xml, results, outermost ) { |
|
2516
|
|
|
var elem, j, matcher, |
|
2517
|
|
|
matchedCount = 0, |
|
2518
|
|
|
i = "0", |
|
2519
|
|
|
unmatched = seed && [], |
|
2520
|
|
|
setMatched = [], |
|
2521
|
|
|
contextBackup = outermostContext, |
|
2522
|
|
|
// We must always have either seed elements or outermost context |
|
2523
|
|
|
elems = seed || byElement && Expr.find["TAG"]( "*", outermost ), |
|
2524
|
|
|
// Use integer dirruns iff this is the outermost matcher |
|
2525
|
|
|
dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1), |
|
2526
|
|
|
len = elems.length; |
|
2527
|
|
|
|
|
2528
|
|
|
if ( outermost ) { |
|
2529
|
|
|
outermostContext = context === document || context || outermost; |
|
2530
|
|
|
} |
|
2531
|
|
|
|
|
2532
|
|
|
// Add elements passing elementMatchers directly to results |
|
2533
|
|
|
// Support: IE<9, Safari |
|
2534
|
|
|
// Tolerate NodeList properties (IE: "length"; Safari: <number>) matching elements by id |
|
2535
|
|
|
for ( ; i !== len && (elem = elems[i]) != null; i++ ) { |
|
2536
|
|
|
if ( byElement && elem ) { |
|
2537
|
|
|
j = 0; |
|
2538
|
|
|
if ( !context && elem.ownerDocument !== document ) { |
|
2539
|
|
|
setDocument( elem ); |
|
2540
|
|
|
xml = !documentIsHTML; |
|
2541
|
|
|
} |
|
2542
|
|
|
while ( (matcher = elementMatchers[j++]) ) { |
|
2543
|
|
|
if ( matcher( elem, context || document, xml) ) { |
|
2544
|
|
|
results.push( elem ); |
|
2545
|
|
|
break; |
|
2546
|
|
|
} |
|
2547
|
|
|
} |
|
2548
|
|
|
if ( outermost ) { |
|
2549
|
|
|
dirruns = dirrunsUnique; |
|
2550
|
|
|
} |
|
2551
|
|
|
} |
|
2552
|
|
|
|
|
2553
|
|
|
// Track unmatched elements for set filters |
|
2554
|
|
|
if ( bySet ) { |
|
2555
|
|
|
// They will have gone through all possible matchers |
|
2556
|
|
|
if ( (elem = !matcher && elem) ) { |
|
2557
|
|
|
matchedCount--; |
|
2558
|
|
|
} |
|
2559
|
|
|
|
|
2560
|
|
|
// Lengthen the array for every element, matched or not |
|
2561
|
|
|
if ( seed ) { |
|
2562
|
|
|
unmatched.push( elem ); |
|
2563
|
|
|
} |
|
2564
|
|
|
} |
|
2565
|
|
|
} |
|
2566
|
|
|
|
|
2567
|
|
|
// `i` is now the count of elements visited above, and adding it to `matchedCount` |
|
2568
|
|
|
// makes the latter nonnegative. |
|
2569
|
|
|
matchedCount += i; |
|
2570
|
|
|
|
|
2571
|
|
|
// Apply set filters to unmatched elements |
|
2572
|
|
|
// NOTE: This can be skipped if there are no unmatched elements (i.e., `matchedCount` |
|
2573
|
|
|
// equals `i`), unless we didn't visit _any_ elements in the above loop because we have |
|
2574
|
|
|
// no element matchers and no seed. |
|
2575
|
|
|
// Incrementing an initially-string "0" `i` allows `i` to remain a string only in that |
|
2576
|
|
|
// case, which will result in a "00" `matchedCount` that differs from `i` but is also |
|
2577
|
|
|
// numerically zero. |
|
2578
|
|
|
if ( bySet && i !== matchedCount ) { |
|
2579
|
|
|
j = 0; |
|
2580
|
|
|
while ( (matcher = setMatchers[j++]) ) { |
|
2581
|
|
|
matcher( unmatched, setMatched, context, xml ); |
|
2582
|
|
|
} |
|
2583
|
|
|
|
|
2584
|
|
|
if ( seed ) { |
|
2585
|
|
|
// Reintegrate element matches to eliminate the need for sorting |
|
2586
|
|
|
if ( matchedCount > 0 ) { |
|
2587
|
|
|
while ( i-- ) { |
|
2588
|
|
|
if ( !(unmatched[i] || setMatched[i]) ) { |
|
2589
|
|
|
setMatched[i] = pop.call( results ); |
|
2590
|
|
|
} |
|
2591
|
|
|
} |
|
2592
|
|
|
} |
|
2593
|
|
|
|
|
2594
|
|
|
// Discard index placeholder values to get only actual matches |
|
2595
|
|
|
setMatched = condense( setMatched ); |
|
2596
|
|
|
} |
|
2597
|
|
|
|
|
2598
|
|
|
// Add matches to results |
|
2599
|
|
|
push.apply( results, setMatched ); |
|
2600
|
|
|
|
|
2601
|
|
|
// Seedless set matches succeeding multiple successful matchers stipulate sorting |
|
2602
|
|
|
if ( outermost && !seed && setMatched.length > 0 && |
|
2603
|
|
|
( matchedCount + setMatchers.length ) > 1 ) { |
|
2604
|
|
|
|
|
2605
|
|
|
Sizzle.uniqueSort( results ); |
|
2606
|
|
|
} |
|
2607
|
|
|
} |
|
2608
|
|
|
|
|
2609
|
|
|
// Override manipulation of globals by nested matchers |
|
2610
|
|
|
if ( outermost ) { |
|
2611
|
|
|
dirruns = dirrunsUnique; |
|
2612
|
|
|
outermostContext = contextBackup; |
|
2613
|
|
|
} |
|
2614
|
|
|
|
|
2615
|
|
|
return unmatched; |
|
2616
|
|
|
}; |
|
2617
|
|
|
|
|
2618
|
|
|
return bySet ? |
|
2619
|
|
|
markFunction( superMatcher ) : |
|
2620
|
|
|
superMatcher; |
|
2621
|
|
|
} |
|
2622
|
|
|
|
|
2623
|
|
|
compile = Sizzle.compile = function( selector, match /* Internal Use Only */ ) { |
|
2624
|
|
|
var i, |
|
2625
|
|
|
setMatchers = [], |
|
2626
|
|
|
elementMatchers = [], |
|
2627
|
|
|
cached = compilerCache[ selector + " " ]; |
|
2628
|
|
|
|
|
2629
|
|
|
if ( !cached ) { |
|
2630
|
|
|
// Generate a function of recursive functions that can be used to check each element |
|
2631
|
|
|
if ( !match ) { |
|
2632
|
|
|
match = tokenize( selector ); |
|
2633
|
|
|
} |
|
2634
|
|
|
i = match.length; |
|
2635
|
|
|
while ( i-- ) { |
|
2636
|
|
|
cached = matcherFromTokens( match[i] ); |
|
2637
|
|
|
if ( cached[ expando ] ) { |
|
2638
|
|
|
setMatchers.push( cached ); |
|
2639
|
|
|
} else { |
|
2640
|
|
|
elementMatchers.push( cached ); |
|
2641
|
|
|
} |
|
2642
|
|
|
} |
|
2643
|
|
|
|
|
2644
|
|
|
// Cache the compiled function |
|
2645
|
|
|
cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) ); |
|
2646
|
|
|
|
|
2647
|
|
|
// Save selector and tokenization |
|
2648
|
|
|
cached.selector = selector; |
|
2649
|
|
|
} |
|
2650
|
|
|
return cached; |
|
2651
|
|
|
}; |
|
2652
|
|
|
|
|
2653
|
|
|
/** |
|
2654
|
|
|
* A low-level selection function that works with Sizzle's compiled |
|
2655
|
|
|
* selector functions |
|
2656
|
|
|
* @param {String|Function} selector A selector or a pre-compiled |
|
2657
|
|
|
* selector function built with Sizzle.compile |
|
2658
|
|
|
* @param {Element} context |
|
2659
|
|
|
* @param {Array} [results] |
|
2660
|
|
|
* @param {Array} [seed] A set of elements to match against |
|
2661
|
|
|
*/ |
|
2662
|
|
|
select = Sizzle.select = function( selector, context, results, seed ) { |
|
2663
|
|
|
var i, tokens, token, type, find, |
|
2664
|
|
|
compiled = typeof selector === "function" && selector, |
|
2665
|
|
|
match = !seed && tokenize( (selector = compiled.selector || selector) ); |
|
2666
|
|
|
|
|
2667
|
|
|
results = results || []; |
|
2668
|
|
|
|
|
2669
|
|
|
// Try to minimize operations if there is only one selector in the list and no seed |
|
2670
|
|
|
// (the latter of which guarantees us context) |
|
2671
|
|
|
if ( match.length === 1 ) { |
|
2672
|
|
|
|
|
2673
|
|
|
// Reduce context if the leading compound selector is an ID |
|
2674
|
|
|
tokens = match[0] = match[0].slice( 0 ); |
|
2675
|
|
|
if ( tokens.length > 2 && (token = tokens[0]).type === "ID" && |
|
2676
|
|
|
context.nodeType === 9 && documentIsHTML && Expr.relative[ tokens[1].type ] ) { |
|
2677
|
|
|
|
|
2678
|
|
|
context = ( Expr.find["ID"]( token.matches[0].replace(runescape, funescape), context ) || [] )[0]; |
|
2679
|
|
|
if ( !context ) { |
|
2680
|
|
|
return results; |
|
2681
|
|
|
|
|
2682
|
|
|
// Precompiled matchers will still verify ancestry, so step up a level |
|
2683
|
|
|
} else if ( compiled ) { |
|
2684
|
|
|
context = context.parentNode; |
|
2685
|
|
|
} |
|
2686
|
|
|
|
|
2687
|
|
|
selector = selector.slice( tokens.shift().value.length ); |
|
2688
|
|
|
} |
|
2689
|
|
|
|
|
2690
|
|
|
// Fetch a seed set for right-to-left matching |
|
2691
|
|
|
i = matchExpr["needsContext"].test( selector ) ? 0 : tokens.length; |
|
2692
|
|
|
while ( i-- ) { |
|
2693
|
|
|
token = tokens[i]; |
|
2694
|
|
|
|
|
2695
|
|
|
// Abort if we hit a combinator |
|
2696
|
|
|
if ( Expr.relative[ (type = token.type) ] ) { |
|
2697
|
|
|
break; |
|
2698
|
|
|
} |
|
2699
|
|
|
if ( (find = Expr.find[ type ]) ) { |
|
2700
|
|
|
// Search, expanding context for leading sibling combinators |
|
2701
|
|
|
if ( (seed = find( |
|
2702
|
|
|
token.matches[0].replace( runescape, funescape ), |
|
2703
|
|
|
rsibling.test( tokens[0].type ) && testContext( context.parentNode ) || context |
|
2704
|
|
|
)) ) { |
|
2705
|
|
|
|
|
2706
|
|
|
// If seed is empty or no tokens remain, we can return early |
|
2707
|
|
|
tokens.splice( i, 1 ); |
|
2708
|
|
|
selector = seed.length && toSelector( tokens ); |
|
2709
|
|
|
if ( !selector ) { |
|
2710
|
|
|
push.apply( results, seed ); |
|
2711
|
|
|
return results; |
|
2712
|
|
|
} |
|
2713
|
|
|
|
|
2714
|
|
|
break; |
|
2715
|
|
|
} |
|
2716
|
|
|
} |
|
2717
|
|
|
} |
|
2718
|
|
|
} |
|
2719
|
|
|
|
|
2720
|
|
|
// Compile and execute a filtering function if one is not provided |
|
2721
|
|
|
// Provide `match` to avoid retokenization if we modified the selector above |
|
2722
|
|
|
( compiled || compile( selector, match ) )( |
|
2723
|
|
|
seed, |
|
2724
|
|
|
context, |
|
2725
|
|
|
!documentIsHTML, |
|
2726
|
|
|
results, |
|
2727
|
|
|
!context || rsibling.test( selector ) && testContext( context.parentNode ) || context |
|
2728
|
|
|
); |
|
2729
|
|
|
return results; |
|
2730
|
|
|
}; |
|
2731
|
|
|
|
|
2732
|
|
|
// One-time assignments |
|
2733
|
|
|
|
|
2734
|
|
|
// Sort stability |
|
2735
|
|
|
support.sortStable = expando.split("").sort( sortOrder ).join("") === expando; |
|
2736
|
|
|
|
|
2737
|
|
|
// Support: Chrome 14-35+ |
|
2738
|
|
|
// Always assume duplicates if they aren't passed to the comparison function |
|
2739
|
|
|
support.detectDuplicates = !!hasDuplicate; |
|
2740
|
|
|
|
|
2741
|
|
|
// Initialize against the default document |
|
2742
|
|
|
setDocument(); |
|
2743
|
|
|
|
|
2744
|
|
|
// Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27) |
|
2745
|
|
|
// Detached nodes confoundingly follow *each other* |
|
2746
|
|
|
support.sortDetached = assert(function( el ) { |
|
2747
|
|
|
// Should return 1, but returns 4 (following) |
|
2748
|
|
|
return el.compareDocumentPosition( document.createElement("fieldset") ) & 1; |
|
2749
|
|
|
}); |
|
2750
|
|
|
|
|
2751
|
|
|
// Support: IE<8 |
|
2752
|
|
|
// Prevent attribute/property "interpolation" |
|
2753
|
|
|
// https://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx |
|
2754
|
|
|
if ( !assert(function( el ) { |
|
2755
|
|
|
el.innerHTML = "<a href='#'></a>"; |
|
2756
|
|
|
return el.firstChild.getAttribute("href") === "#" ; |
|
2757
|
|
|
}) ) { |
|
2758
|
|
|
addHandle( "type|href|height|width", function( elem, name, isXML ) { |
|
2759
|
|
|
if ( !isXML ) { |
|
2760
|
|
|
return elem.getAttribute( name, name.toLowerCase() === "type" ? 1 : 2 ); |
|
2761
|
|
|
} |
|
2762
|
|
|
}); |
|
2763
|
|
|
} |
|
2764
|
|
|
|
|
2765
|
|
|
// Support: IE<9 |
|
2766
|
|
|
// Use defaultValue in place of getAttribute("value") |
|
2767
|
|
|
if ( !support.attributes || !assert(function( el ) { |
|
2768
|
|
|
el.innerHTML = "<input/>"; |
|
2769
|
|
|
el.firstChild.setAttribute( "value", "" ); |
|
2770
|
|
|
return el.firstChild.getAttribute( "value" ) === ""; |
|
2771
|
|
|
}) ) { |
|
2772
|
|
|
addHandle( "value", function( elem, name, isXML ) { |
|
2773
|
|
|
if ( !isXML && elem.nodeName.toLowerCase() === "input" ) { |
|
2774
|
|
|
return elem.defaultValue; |
|
2775
|
|
|
} |
|
2776
|
|
|
}); |
|
2777
|
|
|
} |
|
2778
|
|
|
|
|
2779
|
|
|
// Support: IE<9 |
|
2780
|
|
|
// Use getAttributeNode to fetch booleans when getAttribute lies |
|
2781
|
|
|
if ( !assert(function( el ) { |
|
2782
|
|
|
return el.getAttribute("disabled") == null; |
|
2783
|
|
|
}) ) { |
|
2784
|
|
|
addHandle( booleans, function( elem, name, isXML ) { |
|
2785
|
|
|
var val; |
|
2786
|
|
|
if ( !isXML ) { |
|
2787
|
|
|
return elem[ name ] === true ? name.toLowerCase() : |
|
2788
|
|
|
(val = elem.getAttributeNode( name )) && val.specified ? |
|
2789
|
|
|
val.value : |
|
2790
|
|
|
null; |
|
2791
|
|
|
} |
|
2792
|
|
|
}); |
|
2793
|
|
|
} |
|
2794
|
|
|
|
|
2795
|
|
|
return Sizzle; |
|
2796
|
|
|
|
|
2797
|
|
|
})( window ); |
|
2798
|
|
|
|
|
2799
|
|
|
|
|
2800
|
|
|
|
|
2801
|
|
|
jQuery.find = Sizzle; |
|
2802
|
|
|
jQuery.expr = Sizzle.selectors; |
|
2803
|
|
|
|
|
2804
|
|
|
// Deprecated |
|
2805
|
|
|
jQuery.expr[ ":" ] = jQuery.expr.pseudos; |
|
2806
|
|
|
jQuery.uniqueSort = jQuery.unique = Sizzle.uniqueSort; |
|
2807
|
|
|
jQuery.text = Sizzle.getText; |
|
2808
|
|
|
jQuery.isXMLDoc = Sizzle.isXML; |
|
2809
|
|
|
jQuery.contains = Sizzle.contains; |
|
2810
|
|
|
jQuery.escapeSelector = Sizzle.escape; |
|
2811
|
|
|
|
|
2812
|
|
|
|
|
2813
|
|
|
|
|
2814
|
|
|
|
|
2815
|
|
|
var dir = function( elem, dir, until ) { |
|
2816
|
|
|
var matched = [], |
|
2817
|
|
|
truncate = until !== undefined; |
|
2818
|
|
|
|
|
2819
|
|
|
while ( ( elem = elem[ dir ] ) && elem.nodeType !== 9 ) { |
|
2820
|
|
|
if ( elem.nodeType === 1 ) { |
|
2821
|
|
|
if ( truncate && jQuery( elem ).is( until ) ) { |
|
2822
|
|
|
break; |
|
2823
|
|
|
} |
|
2824
|
|
|
matched.push( elem ); |
|
2825
|
|
|
} |
|
2826
|
|
|
} |
|
2827
|
|
|
return matched; |
|
2828
|
|
|
}; |
|
2829
|
|
|
|
|
2830
|
|
|
|
|
2831
|
|
|
var siblings = function( n, elem ) { |
|
2832
|
|
|
var matched = []; |
|
2833
|
|
|
|
|
2834
|
|
|
for ( ; n; n = n.nextSibling ) { |
|
2835
|
|
|
if ( n.nodeType === 1 && n !== elem ) { |
|
2836
|
|
|
matched.push( n ); |
|
2837
|
|
|
} |
|
2838
|
|
|
} |
|
2839
|
|
|
|
|
2840
|
|
|
return matched; |
|
2841
|
|
|
}; |
|
2842
|
|
|
|
|
2843
|
|
|
|
|
2844
|
|
|
var rneedsContext = jQuery.expr.match.needsContext; |
|
2845
|
|
|
|
|
2846
|
|
|
var rsingleTag = ( /^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i ); |
|
2847
|
|
|
|
|
2848
|
|
|
|
|
2849
|
|
|
|
|
2850
|
|
|
var risSimple = /^.[^:#\[\.,]*$/; |
|
2851
|
|
|
|
|
2852
|
|
|
// Implement the identical functionality for filter and not |
|
2853
|
|
|
function winnow( elements, qualifier, not ) { |
|
2854
|
|
|
if ( jQuery.isFunction( qualifier ) ) { |
|
2855
|
|
|
return jQuery.grep( elements, function( elem, i ) { |
|
2856
|
|
|
return !!qualifier.call( elem, i, elem ) !== not; |
|
2857
|
|
|
} ); |
|
2858
|
|
|
} |
|
2859
|
|
|
|
|
2860
|
|
|
// Single element |
|
2861
|
|
|
if ( qualifier.nodeType ) { |
|
2862
|
|
|
return jQuery.grep( elements, function( elem ) { |
|
2863
|
|
|
return ( elem === qualifier ) !== not; |
|
2864
|
|
|
} ); |
|
2865
|
|
|
} |
|
2866
|
|
|
|
|
2867
|
|
|
// Arraylike of elements (jQuery, arguments, Array) |
|
2868
|
|
|
if ( typeof qualifier !== "string" ) { |
|
2869
|
|
|
return jQuery.grep( elements, function( elem ) { |
|
2870
|
|
|
return ( indexOf.call( qualifier, elem ) > -1 ) !== not; |
|
2871
|
|
|
} ); |
|
2872
|
|
|
} |
|
2873
|
|
|
|
|
2874
|
|
|
// Simple selector that can be filtered directly, removing non-Elements |
|
2875
|
|
|
if ( risSimple.test( qualifier ) ) { |
|
2876
|
|
|
return jQuery.filter( qualifier, elements, not ); |
|
2877
|
|
|
} |
|
2878
|
|
|
|
|
2879
|
|
|
// Complex selector, compare the two sets, removing non-Elements |
|
2880
|
|
|
qualifier = jQuery.filter( qualifier, elements ); |
|
2881
|
|
|
return jQuery.grep( elements, function( elem ) { |
|
2882
|
|
|
return ( indexOf.call( qualifier, elem ) > -1 ) !== not && elem.nodeType === 1; |
|
2883
|
|
|
} ); |
|
2884
|
|
|
} |
|
2885
|
|
|
|
|
2886
|
|
|
jQuery.filter = function( expr, elems, not ) { |
|
2887
|
|
|
var elem = elems[ 0 ]; |
|
2888
|
|
|
|
|
2889
|
|
|
if ( not ) { |
|
2890
|
|
|
expr = ":not(" + expr + ")"; |
|
2891
|
|
|
} |
|
2892
|
|
|
|
|
2893
|
|
|
if ( elems.length === 1 && elem.nodeType === 1 ) { |
|
2894
|
|
|
return jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : []; |
|
2895
|
|
|
} |
|
2896
|
|
|
|
|
2897
|
|
|
return jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) { |
|
2898
|
|
|
return elem.nodeType === 1; |
|
2899
|
|
|
} ) ); |
|
2900
|
|
|
}; |
|
2901
|
|
|
|
|
2902
|
|
|
jQuery.fn.extend( { |
|
2903
|
|
|
find: function( selector ) { |
|
2904
|
|
|
var i, ret, |
|
2905
|
|
|
len = this.length, |
|
2906
|
|
|
self = this; |
|
2907
|
|
|
|
|
2908
|
|
|
if ( typeof selector !== "string" ) { |
|
2909
|
|
|
return this.pushStack( jQuery( selector ).filter( function() { |
|
2910
|
|
|
for ( i = 0; i < len; i++ ) { |
|
2911
|
|
|
if ( jQuery.contains( self[ i ], this ) ) { |
|
2912
|
|
|
return true; |
|
2913
|
|
|
} |
|
2914
|
|
|
} |
|
2915
|
|
|
} ) ); |
|
2916
|
|
|
} |
|
2917
|
|
|
|
|
2918
|
|
|
ret = this.pushStack( [] ); |
|
2919
|
|
|
|
|
2920
|
|
|
for ( i = 0; i < len; i++ ) { |
|
2921
|
|
|
jQuery.find( selector, self[ i ], ret ); |
|
2922
|
|
|
} |
|
2923
|
|
|
|
|
2924
|
|
|
return len > 1 ? jQuery.uniqueSort( ret ) : ret; |
|
2925
|
|
|
}, |
|
2926
|
|
|
filter: function( selector ) { |
|
2927
|
|
|
return this.pushStack( winnow( this, selector || [], false ) ); |
|
2928
|
|
|
}, |
|
2929
|
|
|
not: function( selector ) { |
|
2930
|
|
|
return this.pushStack( winnow( this, selector || [], true ) ); |
|
2931
|
|
|
}, |
|
2932
|
|
|
is: function( selector ) { |
|
2933
|
|
|
return !!winnow( |
|
2934
|
|
|
this, |
|
2935
|
|
|
|
|
2936
|
|
|
// If this is a positional/relative selector, check membership in the returned set |
|
2937
|
|
|
// so $("p:first").is("p:last") won't return true for a doc with two "p". |
|
2938
|
|
|
typeof selector === "string" && rneedsContext.test( selector ) ? |
|
2939
|
|
|
jQuery( selector ) : |
|
2940
|
|
|
selector || [], |
|
2941
|
|
|
false |
|
2942
|
|
|
).length; |
|
2943
|
|
|
} |
|
2944
|
|
|
} ); |
|
2945
|
|
|
|
|
2946
|
|
|
|
|
2947
|
|
|
// Initialize a jQuery object |
|
2948
|
|
|
|
|
2949
|
|
|
|
|
2950
|
|
|
// A central reference to the root jQuery(document) |
|
2951
|
|
|
var rootjQuery, |
|
2952
|
|
|
|
|
2953
|
|
|
// A simple way to check for HTML strings |
|
2954
|
|
|
// Prioritize #id over <tag> to avoid XSS via location.hash (#9521) |
|
2955
|
|
|
// Strict HTML recognition (#11290: must start with <) |
|
2956
|
|
|
// Shortcut simple #id case for speed |
|
2957
|
|
|
rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/, |
|
2958
|
|
|
|
|
2959
|
|
|
init = jQuery.fn.init = function( selector, context, root ) { |
|
2960
|
|
|
var match, elem; |
|
2961
|
|
|
|
|
2962
|
|
|
// HANDLE: $(""), $(null), $(undefined), $(false) |
|
2963
|
|
|
if ( !selector ) { |
|
2964
|
|
|
return this; |
|
2965
|
|
|
} |
|
2966
|
|
|
|
|
2967
|
|
|
// Method init() accepts an alternate rootjQuery |
|
2968
|
|
|
// so migrate can support jQuery.sub (gh-2101) |
|
2969
|
|
|
root = root || rootjQuery; |
|
2970
|
|
|
|
|
2971
|
|
|
// Handle HTML strings |
|
2972
|
|
|
if ( typeof selector === "string" ) { |
|
2973
|
|
|
if ( selector[ 0 ] === "<" && |
|
2974
|
|
|
selector[ selector.length - 1 ] === ">" && |
|
2975
|
|
|
selector.length >= 3 ) { |
|
2976
|
|
|
|
|
2977
|
|
|
// Assume that strings that start and end with <> are HTML and skip the regex check |
|
2978
|
|
|
match = [ null, selector, null ]; |
|
2979
|
|
|
|
|
2980
|
|
|
} else { |
|
2981
|
|
|
match = rquickExpr.exec( selector ); |
|
2982
|
|
|
} |
|
2983
|
|
|
|
|
2984
|
|
|
// Match html or make sure no context is specified for #id |
|
2985
|
|
|
if ( match && ( match[ 1 ] || !context ) ) { |
|
2986
|
|
|
|
|
2987
|
|
|
// HANDLE: $(html) -> $(array) |
|
2988
|
|
|
if ( match[ 1 ] ) { |
|
2989
|
|
|
context = context instanceof jQuery ? context[ 0 ] : context; |
|
2990
|
|
|
|
|
2991
|
|
|
// Option to run scripts is true for back-compat |
|
2992
|
|
|
// Intentionally let the error be thrown if parseHTML is not present |
|
2993
|
|
|
jQuery.merge( this, jQuery.parseHTML( |
|
2994
|
|
|
match[ 1 ], |
|
2995
|
|
|
context && context.nodeType ? context.ownerDocument || context : document, |
|
2996
|
|
|
true |
|
2997
|
|
|
) ); |
|
2998
|
|
|
|
|
2999
|
|
|
// HANDLE: $(html, props) |
|
3000
|
|
|
if ( rsingleTag.test( match[ 1 ] ) && jQuery.isPlainObject( context ) ) { |
|
3001
|
|
|
for ( match in context ) { |
|
3002
|
|
|
|
|
3003
|
|
|
// Properties of context are called as methods if possible |
|
3004
|
|
|
if ( jQuery.isFunction( this[ match ] ) ) { |
|
3005
|
|
|
this[ match ]( context[ match ] ); |
|
3006
|
|
|
|
|
3007
|
|
|
// ...and otherwise set as attributes |
|
3008
|
|
|
} else { |
|
3009
|
|
|
this.attr( match, context[ match ] ); |
|
3010
|
|
|
} |
|
3011
|
|
|
} |
|
3012
|
|
|
} |
|
3013
|
|
|
|
|
3014
|
|
|
return this; |
|
3015
|
|
|
|
|
3016
|
|
|
// HANDLE: $(#id) |
|
3017
|
|
|
} else { |
|
3018
|
|
|
elem = document.getElementById( match[ 2 ] ); |
|
3019
|
|
|
|
|
3020
|
|
|
if ( elem ) { |
|
3021
|
|
|
|
|
3022
|
|
|
// Inject the element directly into the jQuery object |
|
3023
|
|
|
this[ 0 ] = elem; |
|
3024
|
|
|
this.length = 1; |
|
3025
|
|
|
} |
|
3026
|
|
|
return this; |
|
3027
|
|
|
} |
|
3028
|
|
|
|
|
3029
|
|
|
// HANDLE: $(expr, $(...)) |
|
3030
|
|
|
} else if ( !context || context.jquery ) { |
|
3031
|
|
|
return ( context || root ).find( selector ); |
|
3032
|
|
|
|
|
3033
|
|
|
// HANDLE: $(expr, context) |
|
3034
|
|
|
// (which is just equivalent to: $(context).find(expr) |
|
3035
|
|
|
} else { |
|
3036
|
|
|
return this.constructor( context ).find( selector ); |
|
3037
|
|
|
} |
|
3038
|
|
|
|
|
3039
|
|
|
// HANDLE: $(DOMElement) |
|
3040
|
|
|
} else if ( selector.nodeType ) { |
|
3041
|
|
|
this[ 0 ] = selector; |
|
3042
|
|
|
this.length = 1; |
|
3043
|
|
|
return this; |
|
3044
|
|
|
|
|
3045
|
|
|
// HANDLE: $(function) |
|
3046
|
|
|
// Shortcut for document ready |
|
3047
|
|
|
} else if ( jQuery.isFunction( selector ) ) { |
|
3048
|
|
|
return root.ready !== undefined ? |
|
3049
|
|
|
root.ready( selector ) : |
|
3050
|
|
|
|
|
3051
|
|
|
// Execute immediately if ready is not present |
|
3052
|
|
|
selector( jQuery ); |
|
3053
|
|
|
} |
|
3054
|
|
|
|
|
3055
|
|
|
return jQuery.makeArray( selector, this ); |
|
3056
|
|
|
}; |
|
3057
|
|
|
|
|
3058
|
|
|
// Give the init function the jQuery prototype for later instantiation |
|
3059
|
|
|
init.prototype = jQuery.fn; |
|
3060
|
|
|
|
|
3061
|
|
|
// Initialize central reference |
|
3062
|
|
|
rootjQuery = jQuery( document ); |
|
3063
|
|
|
|
|
3064
|
|
|
|
|
3065
|
|
|
var rparentsprev = /^(?:parents|prev(?:Until|All))/, |
|
3066
|
|
|
|
|
3067
|
|
|
// Methods guaranteed to produce a unique set when starting from a unique set |
|
3068
|
|
|
guaranteedUnique = { |
|
3069
|
|
|
children: true, |
|
3070
|
|
|
contents: true, |
|
3071
|
|
|
next: true, |
|
3072
|
|
|
prev: true |
|
3073
|
|
|
}; |
|
3074
|
|
|
|
|
3075
|
|
|
jQuery.fn.extend( { |
|
3076
|
|
|
has: function( target ) { |
|
3077
|
|
|
var targets = jQuery( target, this ), |
|
3078
|
|
|
l = targets.length; |
|
3079
|
|
|
|
|
3080
|
|
|
return this.filter( function() { |
|
3081
|
|
|
var i = 0; |
|
3082
|
|
|
for ( ; i < l; i++ ) { |
|
3083
|
|
|
if ( jQuery.contains( this, targets[ i ] ) ) { |
|
3084
|
|
|
return true; |
|
3085
|
|
|
} |
|
3086
|
|
|
} |
|
3087
|
|
|
} ); |
|
3088
|
|
|
}, |
|
3089
|
|
|
|
|
3090
|
|
|
closest: function( selectors, context ) { |
|
3091
|
|
|
var cur, |
|
3092
|
|
|
i = 0, |
|
3093
|
|
|
l = this.length, |
|
3094
|
|
|
matched = [], |
|
3095
|
|
|
targets = typeof selectors !== "string" && jQuery( selectors ); |
|
3096
|
|
|
|
|
3097
|
|
|
// Positional selectors never match, since there's no _selection_ context |
|
3098
|
|
|
if ( !rneedsContext.test( selectors ) ) { |
|
3099
|
|
|
for ( ; i < l; i++ ) { |
|
3100
|
|
|
for ( cur = this[ i ]; cur && cur !== context; cur = cur.parentNode ) { |
|
3101
|
|
|
|
|
3102
|
|
|
// Always skip document fragments |
|
3103
|
|
|
if ( cur.nodeType < 11 && ( targets ? |
|
3104
|
|
|
targets.index( cur ) > -1 : |
|
3105
|
|
|
|
|
3106
|
|
|
// Don't pass non-elements to Sizzle |
|
3107
|
|
|
cur.nodeType === 1 && |
|
3108
|
|
|
jQuery.find.matchesSelector( cur, selectors ) ) ) { |
|
3109
|
|
|
|
|
3110
|
|
|
matched.push( cur ); |
|
3111
|
|
|
break; |
|
3112
|
|
|
} |
|
3113
|
|
|
} |
|
3114
|
|
|
} |
|
3115
|
|
|
} |
|
3116
|
|
|
|
|
3117
|
|
|
return this.pushStack( matched.length > 1 ? jQuery.uniqueSort( matched ) : matched ); |
|
3118
|
|
|
}, |
|
3119
|
|
|
|
|
3120
|
|
|
// Determine the position of an element within the set |
|
3121
|
|
|
index: function( elem ) { |
|
3122
|
|
|
|
|
3123
|
|
|
// No argument, return index in parent |
|
3124
|
|
|
if ( !elem ) { |
|
3125
|
|
|
return ( this[ 0 ] && this[ 0 ].parentNode ) ? this.first().prevAll().length : -1; |
|
3126
|
|
|
} |
|
3127
|
|
|
|
|
3128
|
|
|
// Index in selector |
|
3129
|
|
|
if ( typeof elem === "string" ) { |
|
3130
|
|
|
return indexOf.call( jQuery( elem ), this[ 0 ] ); |
|
3131
|
|
|
} |
|
3132
|
|
|
|
|
3133
|
|
|
// Locate the position of the desired element |
|
3134
|
|
|
return indexOf.call( this, |
|
3135
|
|
|
|
|
3136
|
|
|
// If it receives a jQuery object, the first element is used |
|
3137
|
|
|
elem.jquery ? elem[ 0 ] : elem |
|
3138
|
|
|
); |
|
3139
|
|
|
}, |
|
3140
|
|
|
|
|
3141
|
|
|
add: function( selector, context ) { |
|
3142
|
|
|
return this.pushStack( |
|
3143
|
|
|
jQuery.uniqueSort( |
|
3144
|
|
|
jQuery.merge( this.get(), jQuery( selector, context ) ) |
|
3145
|
|
|
) |
|
3146
|
|
|
); |
|
3147
|
|
|
}, |
|
3148
|
|
|
|
|
3149
|
|
|
addBack: function( selector ) { |
|
3150
|
|
|
return this.add( selector == null ? |
|
3151
|
|
|
this.prevObject : this.prevObject.filter( selector ) |
|
3152
|
|
|
); |
|
3153
|
|
|
} |
|
3154
|
|
|
} ); |
|
3155
|
|
|
|
|
3156
|
|
|
function sibling( cur, dir ) { |
|
3157
|
|
|
while ( ( cur = cur[ dir ] ) && cur.nodeType !== 1 ) {} |
|
3158
|
|
|
return cur; |
|
3159
|
|
|
} |
|
3160
|
|
|
|
|
3161
|
|
|
jQuery.each( { |
|
3162
|
|
|
parent: function( elem ) { |
|
3163
|
|
|
var parent = elem.parentNode; |
|
3164
|
|
|
return parent && parent.nodeType !== 11 ? parent : null; |
|
3165
|
|
|
}, |
|
3166
|
|
|
parents: function( elem ) { |
|
3167
|
|
|
return dir( elem, "parentNode" ); |
|
3168
|
|
|
}, |
|
3169
|
|
|
parentsUntil: function( elem, i, until ) { |
|
3170
|
|
|
return dir( elem, "parentNode", until ); |
|
3171
|
|
|
}, |
|
3172
|
|
|
next: function( elem ) { |
|
3173
|
|
|
return sibling( elem, "nextSibling" ); |
|
3174
|
|
|
}, |
|
3175
|
|
|
prev: function( elem ) { |
|
3176
|
|
|
return sibling( elem, "previousSibling" ); |
|
3177
|
|
|
}, |
|
3178
|
|
|
nextAll: function( elem ) { |
|
3179
|
|
|
return dir( elem, "nextSibling" ); |
|
3180
|
|
|
}, |
|
3181
|
|
|
prevAll: function( elem ) { |
|
3182
|
|
|
return dir( elem, "previousSibling" ); |
|
3183
|
|
|
}, |
|
3184
|
|
|
nextUntil: function( elem, i, until ) { |
|
3185
|
|
|
return dir( elem, "nextSibling", until ); |
|
3186
|
|
|
}, |
|
3187
|
|
|
prevUntil: function( elem, i, until ) { |
|
3188
|
|
|
return dir( elem, "previousSibling", until ); |
|
3189
|
|
|
}, |
|
3190
|
|
|
siblings: function( elem ) { |
|
3191
|
|
|
return siblings( ( elem.parentNode || {} ).firstChild, elem ); |
|
3192
|
|
|
}, |
|
3193
|
|
|
children: function( elem ) { |
|
3194
|
|
|
return siblings( elem.firstChild ); |
|
3195
|
|
|
}, |
|
3196
|
|
|
contents: function( elem ) { |
|
3197
|
|
|
return elem.contentDocument || jQuery.merge( [], elem.childNodes ); |
|
3198
|
|
|
} |
|
3199
|
|
|
}, function( name, fn ) { |
|
3200
|
|
|
jQuery.fn[ name ] = function( until, selector ) { |
|
3201
|
|
|
var matched = jQuery.map( this, fn, until ); |
|
3202
|
|
|
|
|
3203
|
|
|
if ( name.slice( -5 ) !== "Until" ) { |
|
3204
|
|
|
selector = until; |
|
3205
|
|
|
} |
|
3206
|
|
|
|
|
3207
|
|
|
if ( selector && typeof selector === "string" ) { |
|
3208
|
|
|
matched = jQuery.filter( selector, matched ); |
|
3209
|
|
|
} |
|
3210
|
|
|
|
|
3211
|
|
|
if ( this.length > 1 ) { |
|
3212
|
|
|
|
|
3213
|
|
|
// Remove duplicates |
|
3214
|
|
|
if ( !guaranteedUnique[ name ] ) { |
|
3215
|
|
|
jQuery.uniqueSort( matched ); |
|
3216
|
|
|
} |
|
3217
|
|
|
|
|
3218
|
|
|
// Reverse order for parents* and prev-derivatives |
|
3219
|
|
|
if ( rparentsprev.test( name ) ) { |
|
3220
|
|
|
matched.reverse(); |
|
3221
|
|
|
} |
|
3222
|
|
|
} |
|
3223
|
|
|
|
|
3224
|
|
|
return this.pushStack( matched ); |
|
3225
|
|
|
}; |
|
3226
|
|
|
} ); |
|
3227
|
|
|
var rnothtmlwhite = ( /[^\x20\t\r\n\f]+/g ); |
|
3228
|
|
|
|
|
3229
|
|
|
|
|
3230
|
|
|
|
|
3231
|
|
|
// Convert String-formatted options into Object-formatted ones |
|
3232
|
|
|
function createOptions( options ) { |
|
3233
|
|
|
var object = {}; |
|
3234
|
|
|
jQuery.each( options.match( rnothtmlwhite ) || [], function( _, flag ) { |
|
3235
|
|
|
object[ flag ] = true; |
|
3236
|
|
|
} ); |
|
3237
|
|
|
return object; |
|
3238
|
|
|
} |
|
3239
|
|
|
|
|
3240
|
|
|
/* |
|
3241
|
|
|
* Create a callback list using the following parameters: |
|
3242
|
|
|
* |
|
3243
|
|
|
* options: an optional list of space-separated options that will change how |
|
3244
|
|
|
* the callback list behaves or a more traditional option object |
|
3245
|
|
|
* |
|
3246
|
|
|
* By default a callback list will act like an event callback list and can be |
|
3247
|
|
|
* "fired" multiple times. |
|
3248
|
|
|
* |
|
3249
|
|
|
* Possible options: |
|
3250
|
|
|
* |
|
3251
|
|
|
* once: will ensure the callback list can only be fired once (like a Deferred) |
|
3252
|
|
|
* |
|
3253
|
|
|
* memory: will keep track of previous values and will call any callback added |
|
3254
|
|
|
* after the list has been fired right away with the latest "memorized" |
|
3255
|
|
|
* values (like a Deferred) |
|
3256
|
|
|
* |
|
3257
|
|
|
* unique: will ensure a callback can only be added once (no duplicate in the list) |
|
3258
|
|
|
* |
|
3259
|
|
|
* stopOnFalse: interrupt callings when a callback returns false |
|
3260
|
|
|
* |
|
3261
|
|
|
*/ |
|
3262
|
|
|
jQuery.Callbacks = function( options ) { |
|
3263
|
|
|
|
|
3264
|
|
|
// Convert options from String-formatted to Object-formatted if needed |
|
3265
|
|
|
// (we check in cache first) |
|
3266
|
|
|
options = typeof options === "string" ? |
|
3267
|
|
|
createOptions( options ) : |
|
3268
|
|
|
jQuery.extend( {}, options ); |
|
3269
|
|
|
|
|
3270
|
|
|
var // Flag to know if list is currently firing |
|
3271
|
|
|
firing, |
|
3272
|
|
|
|
|
3273
|
|
|
// Last fire value for non-forgettable lists |
|
3274
|
|
|
memory, |
|
3275
|
|
|
|
|
3276
|
|
|
// Flag to know if list was already fired |
|
3277
|
|
|
fired, |
|
3278
|
|
|
|
|
3279
|
|
|
// Flag to prevent firing |
|
3280
|
|
|
locked, |
|
3281
|
|
|
|
|
3282
|
|
|
// Actual callback list |
|
3283
|
|
|
list = [], |
|
3284
|
|
|
|
|
3285
|
|
|
// Queue of execution data for repeatable lists |
|
3286
|
|
|
queue = [], |
|
3287
|
|
|
|
|
3288
|
|
|
// Index of currently firing callback (modified by add/remove as needed) |
|
3289
|
|
|
firingIndex = -1, |
|
3290
|
|
|
|
|
3291
|
|
|
// Fire callbacks |
|
3292
|
|
|
fire = function() { |
|
3293
|
|
|
|
|
3294
|
|
|
// Enforce single-firing |
|
3295
|
|
|
locked = options.once; |
|
3296
|
|
|
|
|
3297
|
|
|
// Execute callbacks for all pending executions, |
|
3298
|
|
|
// respecting firingIndex overrides and runtime changes |
|
3299
|
|
|
fired = firing = true; |
|
3300
|
|
|
for ( ; queue.length; firingIndex = -1 ) { |
|
3301
|
|
|
memory = queue.shift(); |
|
3302
|
|
|
while ( ++firingIndex < list.length ) { |
|
3303
|
|
|
|
|
3304
|
|
|
// Run callback and check for early termination |
|
3305
|
|
|
if ( list[ firingIndex ].apply( memory[ 0 ], memory[ 1 ] ) === false && |
|
3306
|
|
|
options.stopOnFalse ) { |
|
3307
|
|
|
|
|
3308
|
|
|
// Jump to end and forget the data so .add doesn't re-fire |
|
3309
|
|
|
firingIndex = list.length; |
|
3310
|
|
|
memory = false; |
|
3311
|
|
|
} |
|
3312
|
|
|
} |
|
3313
|
|
|
} |
|
3314
|
|
|
|
|
3315
|
|
|
// Forget the data if we're done with it |
|
3316
|
|
|
if ( !options.memory ) { |
|
3317
|
|
|
memory = false; |
|
3318
|
|
|
} |
|
3319
|
|
|
|
|
3320
|
|
|
firing = false; |
|
3321
|
|
|
|
|
3322
|
|
|
// Clean up if we're done firing for good |
|
3323
|
|
|
if ( locked ) { |
|
3324
|
|
|
|
|
3325
|
|
|
// Keep an empty list if we have data for future add calls |
|
3326
|
|
|
if ( memory ) { |
|
3327
|
|
|
list = []; |
|
3328
|
|
|
|
|
3329
|
|
|
// Otherwise, this object is spent |
|
3330
|
|
|
} else { |
|
3331
|
|
|
list = ""; |
|
3332
|
|
|
} |
|
3333
|
|
|
} |
|
3334
|
|
|
}, |
|
3335
|
|
|
|
|
3336
|
|
|
// Actual Callbacks object |
|
3337
|
|
|
self = { |
|
3338
|
|
|
|
|
3339
|
|
|
// Add a callback or a collection of callbacks to the list |
|
3340
|
|
|
add: function() { |
|
3341
|
|
|
if ( list ) { |
|
3342
|
|
|
|
|
3343
|
|
|
// If we have memory from a past run, we should fire after adding |
|
3344
|
|
|
if ( memory && !firing ) { |
|
3345
|
|
|
firingIndex = list.length - 1; |
|
3346
|
|
|
queue.push( memory ); |
|
3347
|
|
|
} |
|
3348
|
|
|
|
|
3349
|
|
|
( function add( args ) { |
|
3350
|
|
|
jQuery.each( args, function( _, arg ) { |
|
3351
|
|
|
if ( jQuery.isFunction( arg ) ) { |
|
3352
|
|
|
if ( !options.unique || !self.has( arg ) ) { |
|
3353
|
|
|
list.push( arg ); |
|
3354
|
|
|
} |
|
3355
|
|
|
} else if ( arg && arg.length && jQuery.type( arg ) !== "string" ) { |
|
3356
|
|
|
|
|
3357
|
|
|
// Inspect recursively |
|
3358
|
|
|
add( arg ); |
|
3359
|
|
|
} |
|
3360
|
|
|
} ); |
|
3361
|
|
|
} )( arguments ); |
|
3362
|
|
|
|
|
3363
|
|
|
if ( memory && !firing ) { |
|
3364
|
|
|
fire(); |
|
3365
|
|
|
} |
|
3366
|
|
|
} |
|
3367
|
|
|
return this; |
|
3368
|
|
|
}, |
|
3369
|
|
|
|
|
3370
|
|
|
// Remove a callback from the list |
|
3371
|
|
|
remove: function() { |
|
3372
|
|
|
jQuery.each( arguments, function( _, arg ) { |
|
3373
|
|
|
var index; |
|
3374
|
|
|
while ( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) { |
|
3375
|
|
|
list.splice( index, 1 ); |
|
3376
|
|
|
|
|
3377
|
|
|
// Handle firing indexes |
|
3378
|
|
|
if ( index <= firingIndex ) { |
|
3379
|
|
|
firingIndex--; |
|
3380
|
|
|
} |
|
3381
|
|
|
} |
|
3382
|
|
|
} ); |
|
3383
|
|
|
return this; |
|
3384
|
|
|
}, |
|
3385
|
|
|
|
|
3386
|
|
|
// Check if a given callback is in the list. |
|
3387
|
|
|
// If no argument is given, return whether or not list has callbacks attached. |
|
3388
|
|
|
has: function( fn ) { |
|
3389
|
|
|
return fn ? |
|
3390
|
|
|
jQuery.inArray( fn, list ) > -1 : |
|
3391
|
|
|
list.length > 0; |
|
3392
|
|
|
}, |
|
3393
|
|
|
|
|
3394
|
|
|
// Remove all callbacks from the list |
|
3395
|
|
|
empty: function() { |
|
3396
|
|
|
if ( list ) { |
|
3397
|
|
|
list = []; |
|
3398
|
|
|
} |
|
3399
|
|
|
return this; |
|
3400
|
|
|
}, |
|
3401
|
|
|
|
|
3402
|
|
|
// Disable .fire and .add |
|
3403
|
|
|
// Abort any current/pending executions |
|
3404
|
|
|
// Clear all callbacks and values |
|
3405
|
|
|
disable: function() { |
|
3406
|
|
|
locked = queue = []; |
|
3407
|
|
|
list = memory = ""; |
|
3408
|
|
|
return this; |
|
3409
|
|
|
}, |
|
3410
|
|
|
disabled: function() { |
|
3411
|
|
|
return !list; |
|
3412
|
|
|
}, |
|
3413
|
|
|
|
|
3414
|
|
|
// Disable .fire |
|
3415
|
|
|
// Also disable .add unless we have memory (since it would have no effect) |
|
3416
|
|
|
// Abort any pending executions |
|
3417
|
|
|
lock: function() { |
|
3418
|
|
|
locked = queue = []; |
|
3419
|
|
|
if ( !memory && !firing ) { |
|
3420
|
|
|
list = memory = ""; |
|
3421
|
|
|
} |
|
3422
|
|
|
return this; |
|
3423
|
|
|
}, |
|
3424
|
|
|
locked: function() { |
|
3425
|
|
|
return !!locked; |
|
3426
|
|
|
}, |
|
3427
|
|
|
|
|
3428
|
|
|
// Call all callbacks with the given context and arguments |
|
3429
|
|
|
fireWith: function( context, args ) { |
|
3430
|
|
|
if ( !locked ) { |
|
3431
|
|
|
args = args || []; |
|
3432
|
|
|
args = [ context, args.slice ? args.slice() : args ]; |
|
3433
|
|
|
queue.push( args ); |
|
3434
|
|
|
if ( !firing ) { |
|
3435
|
|
|
fire(); |
|
3436
|
|
|
} |
|
3437
|
|
|
} |
|
3438
|
|
|
return this; |
|
3439
|
|
|
}, |
|
3440
|
|
|
|
|
3441
|
|
|
// Call all the callbacks with the given arguments |
|
3442
|
|
|
fire: function() { |
|
3443
|
|
|
self.fireWith( this, arguments ); |
|
3444
|
|
|
return this; |
|
3445
|
|
|
}, |
|
3446
|
|
|
|
|
3447
|
|
|
// To know if the callbacks have already been called at least once |
|
3448
|
|
|
fired: function() { |
|
3449
|
|
|
return !!fired; |
|
3450
|
|
|
} |
|
3451
|
|
|
}; |
|
3452
|
|
|
|
|
3453
|
|
|
return self; |
|
3454
|
|
|
}; |
|
3455
|
|
|
|
|
3456
|
|
|
|
|
3457
|
|
|
function Identity( v ) { |
|
3458
|
|
|
return v; |
|
3459
|
|
|
} |
|
3460
|
|
|
function Thrower( ex ) { |
|
3461
|
|
|
throw ex; |
|
3462
|
|
|
} |
|
3463
|
|
|
|
|
3464
|
|
|
function adoptValue( value, resolve, reject ) { |
|
3465
|
|
|
var method; |
|
3466
|
|
|
|
|
3467
|
|
|
try { |
|
3468
|
|
|
|
|
3469
|
|
|
// Check for promise aspect first to privilege synchronous behavior |
|
3470
|
|
|
if ( value && jQuery.isFunction( ( method = value.promise ) ) ) { |
|
3471
|
|
|
method.call( value ).done( resolve ).fail( reject ); |
|
3472
|
|
|
|
|
3473
|
|
|
// Other thenables |
|
3474
|
|
|
} else if ( value && jQuery.isFunction( ( method = value.then ) ) ) { |
|
3475
|
|
|
method.call( value, resolve, reject ); |
|
3476
|
|
|
|
|
3477
|
|
|
// Other non-thenables |
|
3478
|
|
|
} else { |
|
3479
|
|
|
|
|
3480
|
|
|
// Support: Android 4.0 only |
|
3481
|
|
|
// Strict mode functions invoked without .call/.apply get global-object context |
|
3482
|
|
|
resolve.call( undefined, value ); |
|
3483
|
|
|
} |
|
3484
|
|
|
|
|
3485
|
|
|
// For Promises/A+, convert exceptions into rejections |
|
3486
|
|
|
// Since jQuery.when doesn't unwrap thenables, we can skip the extra checks appearing in |
|
3487
|
|
|
// Deferred#then to conditionally suppress rejection. |
|
3488
|
|
|
} catch ( value ) { |
|
3489
|
|
|
|
|
3490
|
|
|
// Support: Android 4.0 only |
|
3491
|
|
|
// Strict mode functions invoked without .call/.apply get global-object context |
|
3492
|
|
|
reject.call( undefined, value ); |
|
3493
|
|
|
} |
|
3494
|
|
|
} |
|
3495
|
|
|
|
|
3496
|
|
|
jQuery.extend( { |
|
3497
|
|
|
|
|
3498
|
|
|
Deferred: function( func ) { |
|
3499
|
|
|
var tuples = [ |
|
3500
|
|
|
|
|
3501
|
|
|
// action, add listener, callbacks, |
|
3502
|
|
|
// ... .then handlers, argument index, [final state] |
|
3503
|
|
|
[ "notify", "progress", jQuery.Callbacks( "memory" ), |
|
3504
|
|
|
jQuery.Callbacks( "memory" ), 2 ], |
|
3505
|
|
|
[ "resolve", "done", jQuery.Callbacks( "once memory" ), |
|
3506
|
|
|
jQuery.Callbacks( "once memory" ), 0, "resolved" ], |
|
3507
|
|
|
[ "reject", "fail", jQuery.Callbacks( "once memory" ), |
|
3508
|
|
|
jQuery.Callbacks( "once memory" ), 1, "rejected" ] |
|
3509
|
|
|
], |
|
3510
|
|
|
state = "pending", |
|
3511
|
|
|
promise = { |
|
3512
|
|
|
state: function() { |
|
3513
|
|
|
return state; |
|
3514
|
|
|
}, |
|
3515
|
|
|
always: function() { |
|
3516
|
|
|
deferred.done( arguments ).fail( arguments ); |
|
3517
|
|
|
return this; |
|
3518
|
|
|
}, |
|
3519
|
|
|
"catch": function( fn ) { |
|
3520
|
|
|
return promise.then( null, fn ); |
|
3521
|
|
|
}, |
|
3522
|
|
|
|
|
3523
|
|
|
// Keep pipe for back-compat |
|
3524
|
|
|
pipe: function( /* fnDone, fnFail, fnProgress */ ) { |
|
3525
|
|
|
var fns = arguments; |
|
3526
|
|
|
|
|
3527
|
|
|
return jQuery.Deferred( function( newDefer ) { |
|
3528
|
|
|
jQuery.each( tuples, function( i, tuple ) { |
|
3529
|
|
|
|
|
3530
|
|
|
// Map tuples (progress, done, fail) to arguments (done, fail, progress) |
|
3531
|
|
|
var fn = jQuery.isFunction( fns[ tuple[ 4 ] ] ) && fns[ tuple[ 4 ] ]; |
|
3532
|
|
|
|
|
3533
|
|
|
// deferred.progress(function() { bind to newDefer or newDefer.notify }) |
|
3534
|
|
|
// deferred.done(function() { bind to newDefer or newDefer.resolve }) |
|
3535
|
|
|
// deferred.fail(function() { bind to newDefer or newDefer.reject }) |
|
3536
|
|
|
deferred[ tuple[ 1 ] ]( function() { |
|
3537
|
|
|
var returned = fn && fn.apply( this, arguments ); |
|
3538
|
|
|
if ( returned && jQuery.isFunction( returned.promise ) ) { |
|
3539
|
|
|
returned.promise() |
|
3540
|
|
|
.progress( newDefer.notify ) |
|
3541
|
|
|
.done( newDefer.resolve ) |
|
3542
|
|
|
.fail( newDefer.reject ); |
|
3543
|
|
|
} else { |
|
3544
|
|
|
newDefer[ tuple[ 0 ] + "With" ]( |
|
3545
|
|
|
this, |
|
3546
|
|
|
fn ? [ returned ] : arguments |
|
3547
|
|
|
); |
|
3548
|
|
|
} |
|
3549
|
|
|
} ); |
|
3550
|
|
|
} ); |
|
3551
|
|
|
fns = null; |
|
3552
|
|
|
} ).promise(); |
|
3553
|
|
|
}, |
|
3554
|
|
|
then: function( onFulfilled, onRejected, onProgress ) { |
|
3555
|
|
|
var maxDepth = 0; |
|
3556
|
|
|
function resolve( depth, deferred, handler, special ) { |
|
3557
|
|
|
return function() { |
|
3558
|
|
|
var that = this, |
|
3559
|
|
|
args = arguments, |
|
3560
|
|
|
mightThrow = function() { |
|
3561
|
|
|
var returned, then; |
|
3562
|
|
|
|
|
3563
|
|
|
// Support: Promises/A+ section 2.3.3.3.3 |
|
3564
|
|
|
// https://promisesaplus.com/#point-59 |
|
3565
|
|
|
// Ignore double-resolution attempts |
|
3566
|
|
|
if ( depth < maxDepth ) { |
|
3567
|
|
|
return; |
|
3568
|
|
|
} |
|
3569
|
|
|
|
|
3570
|
|
|
returned = handler.apply( that, args ); |
|
3571
|
|
|
|
|
3572
|
|
|
// Support: Promises/A+ section 2.3.1 |
|
3573
|
|
|
// https://promisesaplus.com/#point-48 |
|
3574
|
|
|
if ( returned === deferred.promise() ) { |
|
3575
|
|
|
throw new TypeError( "Thenable self-resolution" ); |
|
3576
|
|
|
} |
|
3577
|
|
|
|
|
3578
|
|
|
// Support: Promises/A+ sections 2.3.3.1, 3.5 |
|
3579
|
|
|
// https://promisesaplus.com/#point-54 |
|
3580
|
|
|
// https://promisesaplus.com/#point-75 |
|
3581
|
|
|
// Retrieve `then` only once |
|
3582
|
|
|
then = returned && |
|
3583
|
|
|
|
|
3584
|
|
|
// Support: Promises/A+ section 2.3.4 |
|
3585
|
|
|
// https://promisesaplus.com/#point-64 |
|
3586
|
|
|
// Only check objects and functions for thenability |
|
3587
|
|
|
( typeof returned === "object" || |
|
3588
|
|
|
typeof returned === "function" ) && |
|
3589
|
|
|
returned.then; |
|
3590
|
|
|
|
|
3591
|
|
|
// Handle a returned thenable |
|
3592
|
|
|
if ( jQuery.isFunction( then ) ) { |
|
3593
|
|
|
|
|
3594
|
|
|
// Special processors (notify) just wait for resolution |
|
3595
|
|
|
if ( special ) { |
|
3596
|
|
|
then.call( |
|
3597
|
|
|
returned, |
|
3598
|
|
|
resolve( maxDepth, deferred, Identity, special ), |
|
3599
|
|
|
resolve( maxDepth, deferred, Thrower, special ) |
|
3600
|
|
|
); |
|
3601
|
|
|
|
|
3602
|
|
|
// Normal processors (resolve) also hook into progress |
|
3603
|
|
|
} else { |
|
3604
|
|
|
|
|
3605
|
|
|
// ...and disregard older resolution values |
|
3606
|
|
|
maxDepth++; |
|
3607
|
|
|
|
|
3608
|
|
|
then.call( |
|
3609
|
|
|
returned, |
|
3610
|
|
|
resolve( maxDepth, deferred, Identity, special ), |
|
3611
|
|
|
resolve( maxDepth, deferred, Thrower, special ), |
|
3612
|
|
|
resolve( maxDepth, deferred, Identity, |
|
3613
|
|
|
deferred.notifyWith ) |
|
3614
|
|
|
); |
|
3615
|
|
|
} |
|
3616
|
|
|
|
|
3617
|
|
|
// Handle all other returned values |
|
3618
|
|
|
} else { |
|
3619
|
|
|
|
|
3620
|
|
|
// Only substitute handlers pass on context |
|
3621
|
|
|
// and multiple values (non-spec behavior) |
|
3622
|
|
|
if ( handler !== Identity ) { |
|
3623
|
|
|
that = undefined; |
|
3624
|
|
|
args = [ returned ]; |
|
3625
|
|
|
} |
|
3626
|
|
|
|
|
3627
|
|
|
// Process the value(s) |
|
3628
|
|
|
// Default process is resolve |
|
3629
|
|
|
( special || deferred.resolveWith )( that, args ); |
|
3630
|
|
|
} |
|
3631
|
|
|
}, |
|
3632
|
|
|
|
|
3633
|
|
|
// Only normal processors (resolve) catch and reject exceptions |
|
3634
|
|
|
process = special ? |
|
3635
|
|
|
mightThrow : |
|
3636
|
|
|
function() { |
|
3637
|
|
|
try { |
|
3638
|
|
|
mightThrow(); |
|
3639
|
|
|
} catch ( e ) { |
|
3640
|
|
|
|
|
3641
|
|
|
if ( jQuery.Deferred.exceptionHook ) { |
|
3642
|
|
|
jQuery.Deferred.exceptionHook( e, |
|
3643
|
|
|
process.stackTrace ); |
|
3644
|
|
|
} |
|
3645
|
|
|
|
|
3646
|
|
|
// Support: Promises/A+ section 2.3.3.3.4.1 |
|
3647
|
|
|
// https://promisesaplus.com/#point-61 |
|
3648
|
|
|
// Ignore post-resolution exceptions |
|
3649
|
|
|
if ( depth + 1 >= maxDepth ) { |
|
3650
|
|
|
|
|
3651
|
|
|
// Only substitute handlers pass on context |
|
3652
|
|
|
// and multiple values (non-spec behavior) |
|
3653
|
|
|
if ( handler !== Thrower ) { |
|
3654
|
|
|
that = undefined; |
|
3655
|
|
|
args = [ e ]; |
|
3656
|
|
|
} |
|
3657
|
|
|
|
|
3658
|
|
|
deferred.rejectWith( that, args ); |
|
3659
|
|
|
} |
|
3660
|
|
|
} |
|
3661
|
|
|
}; |
|
3662
|
|
|
|
|
3663
|
|
|
// Support: Promises/A+ section 2.3.3.3.1 |
|
3664
|
|
|
// https://promisesaplus.com/#point-57 |
|
3665
|
|
|
// Re-resolve promises immediately to dodge false rejection from |
|
3666
|
|
|
// subsequent errors |
|
3667
|
|
|
if ( depth ) { |
|
3668
|
|
|
process(); |
|
3669
|
|
|
} else { |
|
3670
|
|
|
|
|
3671
|
|
|
// Call an optional hook to record the stack, in case of exception |
|
3672
|
|
|
// since it's otherwise lost when execution goes async |
|
3673
|
|
|
if ( jQuery.Deferred.getStackHook ) { |
|
3674
|
|
|
process.stackTrace = jQuery.Deferred.getStackHook(); |
|
3675
|
|
|
} |
|
3676
|
|
|
window.setTimeout( process ); |
|
3677
|
|
|
} |
|
3678
|
|
|
}; |
|
3679
|
|
|
} |
|
3680
|
|
|
|
|
3681
|
|
|
return jQuery.Deferred( function( newDefer ) { |
|
3682
|
|
|
|
|
3683
|
|
|
// progress_handlers.add( ... ) |
|
3684
|
|
|
tuples[ 0 ][ 3 ].add( |
|
3685
|
|
|
resolve( |
|
3686
|
|
|
0, |
|
3687
|
|
|
newDefer, |
|
3688
|
|
|
jQuery.isFunction( onProgress ) ? |
|
3689
|
|
|
onProgress : |
|
3690
|
|
|
Identity, |
|
3691
|
|
|
newDefer.notifyWith |
|
3692
|
|
|
) |
|
3693
|
|
|
); |
|
3694
|
|
|
|
|
3695
|
|
|
// fulfilled_handlers.add( ... ) |
|
3696
|
|
|
tuples[ 1 ][ 3 ].add( |
|
3697
|
|
|
resolve( |
|
3698
|
|
|
0, |
|
3699
|
|
|
newDefer, |
|
3700
|
|
|
jQuery.isFunction( onFulfilled ) ? |
|
3701
|
|
|
onFulfilled : |
|
3702
|
|
|
Identity |
|
3703
|
|
|
) |
|
3704
|
|
|
); |
|
3705
|
|
|
|
|
3706
|
|
|
// rejected_handlers.add( ... ) |
|
3707
|
|
|
tuples[ 2 ][ 3 ].add( |
|
3708
|
|
|
resolve( |
|
3709
|
|
|
0, |
|
3710
|
|
|
newDefer, |
|
3711
|
|
|
jQuery.isFunction( onRejected ) ? |
|
3712
|
|
|
onRejected : |
|
3713
|
|
|
Thrower |
|
3714
|
|
|
) |
|
3715
|
|
|
); |
|
3716
|
|
|
} ).promise(); |
|
3717
|
|
|
}, |
|
3718
|
|
|
|
|
3719
|
|
|
// Get a promise for this deferred |
|
3720
|
|
|
// If obj is provided, the promise aspect is added to the object |
|
3721
|
|
|
promise: function( obj ) { |
|
3722
|
|
|
return obj != null ? jQuery.extend( obj, promise ) : promise; |
|
3723
|
|
|
} |
|
3724
|
|
|
}, |
|
3725
|
|
|
deferred = {}; |
|
3726
|
|
|
|
|
3727
|
|
|
// Add list-specific methods |
|
3728
|
|
|
jQuery.each( tuples, function( i, tuple ) { |
|
3729
|
|
|
var list = tuple[ 2 ], |
|
3730
|
|
|
stateString = tuple[ 5 ]; |
|
3731
|
|
|
|
|
3732
|
|
|
// promise.progress = list.add |
|
3733
|
|
|
// promise.done = list.add |
|
3734
|
|
|
// promise.fail = list.add |
|
3735
|
|
|
promise[ tuple[ 1 ] ] = list.add; |
|
3736
|
|
|
|
|
3737
|
|
|
// Handle state |
|
3738
|
|
|
if ( stateString ) { |
|
3739
|
|
|
list.add( |
|
3740
|
|
|
function() { |
|
3741
|
|
|
|
|
3742
|
|
|
// state = "resolved" (i.e., fulfilled) |
|
3743
|
|
|
// state = "rejected" |
|
3744
|
|
|
state = stateString; |
|
3745
|
|
|
}, |
|
3746
|
|
|
|
|
3747
|
|
|
// rejected_callbacks.disable |
|
3748
|
|
|
// fulfilled_callbacks.disable |
|
3749
|
|
|
tuples[ 3 - i ][ 2 ].disable, |
|
3750
|
|
|
|
|
3751
|
|
|
// progress_callbacks.lock |
|
3752
|
|
|
tuples[ 0 ][ 2 ].lock |
|
3753
|
|
|
); |
|
3754
|
|
|
} |
|
3755
|
|
|
|
|
3756
|
|
|
// progress_handlers.fire |
|
3757
|
|
|
// fulfilled_handlers.fire |
|
3758
|
|
|
// rejected_handlers.fire |
|
3759
|
|
|
list.add( tuple[ 3 ].fire ); |
|
3760
|
|
|
|
|
3761
|
|
|
// deferred.notify = function() { deferred.notifyWith(...) } |
|
3762
|
|
|
// deferred.resolve = function() { deferred.resolveWith(...) } |
|
3763
|
|
|
// deferred.reject = function() { deferred.rejectWith(...) } |
|
3764
|
|
|
deferred[ tuple[ 0 ] ] = function() { |
|
3765
|
|
|
deferred[ tuple[ 0 ] + "With" ]( this === deferred ? undefined : this, arguments ); |
|
3766
|
|
|
return this; |
|
3767
|
|
|
}; |
|
3768
|
|
|
|
|
3769
|
|
|
// deferred.notifyWith = list.fireWith |
|
3770
|
|
|
// deferred.resolveWith = list.fireWith |
|
3771
|
|
|
// deferred.rejectWith = list.fireWith |
|
3772
|
|
|
deferred[ tuple[ 0 ] + "With" ] = list.fireWith; |
|
3773
|
|
|
} ); |
|
3774
|
|
|
|
|
3775
|
|
|
// Make the deferred a promise |
|
3776
|
|
|
promise.promise( deferred ); |
|
3777
|
|
|
|
|
3778
|
|
|
// Call given func if any |
|
3779
|
|
|
if ( func ) { |
|
3780
|
|
|
func.call( deferred, deferred ); |
|
3781
|
|
|
} |
|
3782
|
|
|
|
|
3783
|
|
|
// All done! |
|
3784
|
|
|
return deferred; |
|
3785
|
|
|
}, |
|
3786
|
|
|
|
|
3787
|
|
|
// Deferred helper |
|
3788
|
|
|
when: function( singleValue ) { |
|
3789
|
|
|
var |
|
3790
|
|
|
|
|
3791
|
|
|
// count of uncompleted subordinates |
|
3792
|
|
|
remaining = arguments.length, |
|
3793
|
|
|
|
|
3794
|
|
|
// count of unprocessed arguments |
|
3795
|
|
|
i = remaining, |
|
3796
|
|
|
|
|
3797
|
|
|
// subordinate fulfillment data |
|
3798
|
|
|
resolveContexts = Array( i ), |
|
3799
|
|
|
resolveValues = slice.call( arguments ), |
|
3800
|
|
|
|
|
3801
|
|
|
// the master Deferred |
|
3802
|
|
|
master = jQuery.Deferred(), |
|
3803
|
|
|
|
|
3804
|
|
|
// subordinate callback factory |
|
3805
|
|
|
updateFunc = function( i ) { |
|
3806
|
|
|
return function( value ) { |
|
3807
|
|
|
resolveContexts[ i ] = this; |
|
3808
|
|
|
resolveValues[ i ] = arguments.length > 1 ? slice.call( arguments ) : value; |
|
3809
|
|
|
if ( !( --remaining ) ) { |
|
3810
|
|
|
master.resolveWith( resolveContexts, resolveValues ); |
|
3811
|
|
|
} |
|
3812
|
|
|
}; |
|
3813
|
|
|
}; |
|
3814
|
|
|
|
|
3815
|
|
|
// Single- and empty arguments are adopted like Promise.resolve |
|
3816
|
|
|
if ( remaining <= 1 ) { |
|
3817
|
|
|
adoptValue( singleValue, master.done( updateFunc( i ) ).resolve, master.reject ); |
|
3818
|
|
|
|
|
3819
|
|
|
// Use .then() to unwrap secondary thenables (cf. gh-3000) |
|
3820
|
|
|
if ( master.state() === "pending" || |
|
3821
|
|
|
jQuery.isFunction( resolveValues[ i ] && resolveValues[ i ].then ) ) { |
|
3822
|
|
|
|
|
3823
|
|
|
return master.then(); |
|
3824
|
|
|
} |
|
3825
|
|
|
} |
|
3826
|
|
|
|
|
3827
|
|
|
// Multiple arguments are aggregated like Promise.all array elements |
|
3828
|
|
|
while ( i-- ) { |
|
3829
|
|
|
adoptValue( resolveValues[ i ], updateFunc( i ), master.reject ); |
|
3830
|
|
|
} |
|
3831
|
|
|
|
|
3832
|
|
|
return master.promise(); |
|
3833
|
|
|
} |
|
3834
|
|
|
} ); |
|
3835
|
|
|
|
|
3836
|
|
|
|
|
3837
|
|
|
// These usually indicate a programmer mistake during development, |
|
3838
|
|
|
// warn about them ASAP rather than swallowing them by default. |
|
3839
|
|
|
var rerrorNames = /^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/; |
|
3840
|
|
|
|
|
3841
|
|
|
jQuery.Deferred.exceptionHook = function( error, stack ) { |
|
3842
|
|
|
|
|
3843
|
|
|
// Support: IE 8 - 9 only |
|
3844
|
|
|
// Console exists when dev tools are open, which can happen at any time |
|
3845
|
|
|
if ( window.console && window.console.warn && error && rerrorNames.test( error.name ) ) { |
|
3846
|
|
|
window.console.warn( "jQuery.Deferred exception: " + error.message, error.stack, stack ); |
|
3847
|
|
|
} |
|
3848
|
|
|
}; |
|
3849
|
|
|
|
|
3850
|
|
|
|
|
3851
|
|
|
|
|
3852
|
|
|
|
|
3853
|
|
|
jQuery.readyException = function( error ) { |
|
3854
|
|
|
window.setTimeout( function() { |
|
3855
|
|
|
throw error; |
|
3856
|
|
|
} ); |
|
3857
|
|
|
}; |
|
3858
|
|
|
|
|
3859
|
|
|
|
|
3860
|
|
|
|
|
3861
|
|
|
|
|
3862
|
|
|
// The deferred used on DOM ready |
|
3863
|
|
|
var readyList = jQuery.Deferred(); |
|
3864
|
|
|
|
|
3865
|
|
|
jQuery.fn.ready = function( fn ) { |
|
3866
|
|
|
|
|
3867
|
|
|
readyList |
|
3868
|
|
|
.then( fn ) |
|
3869
|
|
|
|
|
3870
|
|
|
// Wrap jQuery.readyException in a function so that the lookup |
|
3871
|
|
|
// happens at the time of error handling instead of callback |
|
3872
|
|
|
// registration. |
|
3873
|
|
|
.catch( function( error ) { |
|
3874
|
|
|
jQuery.readyException( error ); |
|
3875
|
|
|
} ); |
|
3876
|
|
|
|
|
3877
|
|
|
return this; |
|
3878
|
|
|
}; |
|
3879
|
|
|
|
|
3880
|
|
|
jQuery.extend( { |
|
3881
|
|
|
|
|
3882
|
|
|
// Is the DOM ready to be used? Set to true once it occurs. |
|
3883
|
|
|
isReady: false, |
|
3884
|
|
|
|
|
3885
|
|
|
// A counter to track how many items to wait for before |
|
3886
|
|
|
// the ready event fires. See #6781 |
|
3887
|
|
|
readyWait: 1, |
|
3888
|
|
|
|
|
3889
|
|
|
// Hold (or release) the ready event |
|
3890
|
|
|
holdReady: function( hold ) { |
|
3891
|
|
|
if ( hold ) { |
|
3892
|
|
|
jQuery.readyWait++; |
|
3893
|
|
|
} else { |
|
3894
|
|
|
jQuery.ready( true ); |
|
3895
|
|
|
} |
|
3896
|
|
|
}, |
|
3897
|
|
|
|
|
3898
|
|
|
// Handle when the DOM is ready |
|
3899
|
|
|
ready: function( wait ) { |
|
3900
|
|
|
|
|
3901
|
|
|
// Abort if there are pending holds or we're already ready |
|
3902
|
|
|
if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) { |
|
3903
|
|
|
return; |
|
3904
|
|
|
} |
|
3905
|
|
|
|
|
3906
|
|
|
// Remember that the DOM is ready |
|
3907
|
|
|
jQuery.isReady = true; |
|
3908
|
|
|
|
|
3909
|
|
|
// If a normal DOM Ready event fired, decrement, and wait if need be |
|
3910
|
|
|
if ( wait !== true && --jQuery.readyWait > 0 ) { |
|
3911
|
|
|
return; |
|
3912
|
|
|
} |
|
3913
|
|
|
|
|
3914
|
|
|
// If there are functions bound, to execute |
|
3915
|
|
|
readyList.resolveWith( document, [ jQuery ] ); |
|
3916
|
|
|
} |
|
3917
|
|
|
} ); |
|
3918
|
|
|
|
|
3919
|
|
|
jQuery.ready.then = readyList.then; |
|
3920
|
|
|
|
|
3921
|
|
|
// The ready event handler and self cleanup method |
|
3922
|
|
|
function completed() { |
|
3923
|
|
|
document.removeEventListener( "DOMContentLoaded", completed ); |
|
3924
|
|
|
window.removeEventListener( "load", completed ); |
|
3925
|
|
|
jQuery.ready(); |
|
3926
|
|
|
} |
|
3927
|
|
|
|
|
3928
|
|
|
// Catch cases where $(document).ready() is called |
|
3929
|
|
|
// after the browser event has already occurred. |
|
3930
|
|
|
// Support: IE <=9 - 10 only |
|
3931
|
|
|
// Older IE sometimes signals "interactive" too soon |
|
3932
|
|
|
if ( document.readyState === "complete" || |
|
3933
|
|
|
( document.readyState !== "loading" && !document.documentElement.doScroll ) ) { |
|
3934
|
|
|
|
|
3935
|
|
|
// Handle it asynchronously to allow scripts the opportunity to delay ready |
|
3936
|
|
|
window.setTimeout( jQuery.ready ); |
|
3937
|
|
|
|
|
3938
|
|
|
} else { |
|
3939
|
|
|
|
|
3940
|
|
|
// Use the handy event callback |
|
3941
|
|
|
document.addEventListener( "DOMContentLoaded", completed ); |
|
3942
|
|
|
|
|
3943
|
|
|
// A fallback to window.onload, that will always work |
|
3944
|
|
|
window.addEventListener( "load", completed ); |
|
3945
|
|
|
} |
|
3946
|
|
|
|
|
3947
|
|
|
|
|
3948
|
|
|
|
|
3949
|
|
|
|
|
3950
|
|
|
// Multifunctional method to get and set values of a collection |
|
3951
|
|
|
// The value/s can optionally be executed if it's a function |
|
3952
|
|
|
var access = function( elems, fn, key, value, chainable, emptyGet, raw ) { |
|
3953
|
|
|
var i = 0, |
|
3954
|
|
|
len = elems.length, |
|
3955
|
|
|
bulk = key == null; |
|
3956
|
|
|
|
|
3957
|
|
|
// Sets many values |
|
3958
|
|
|
if ( jQuery.type( key ) === "object" ) { |
|
3959
|
|
|
chainable = true; |
|
3960
|
|
|
for ( i in key ) { |
|
3961
|
|
|
access( elems, fn, i, key[ i ], true, emptyGet, raw ); |
|
3962
|
|
|
} |
|
3963
|
|
|
|
|
3964
|
|
|
// Sets one value |
|
3965
|
|
|
} else if ( value !== undefined ) { |
|
3966
|
|
|
chainable = true; |
|
3967
|
|
|
|
|
3968
|
|
|
if ( !jQuery.isFunction( value ) ) { |
|
3969
|
|
|
raw = true; |
|
3970
|
|
|
} |
|
3971
|
|
|
|
|
3972
|
|
|
if ( bulk ) { |
|
3973
|
|
|
|
|
3974
|
|
|
// Bulk operations run against the entire set |
|
3975
|
|
|
if ( raw ) { |
|
3976
|
|
|
fn.call( elems, value ); |
|
3977
|
|
|
fn = null; |
|
3978
|
|
|
|
|
3979
|
|
|
// ...except when executing function values |
|
3980
|
|
|
} else { |
|
3981
|
|
|
bulk = fn; |
|
3982
|
|
|
fn = function( elem, key, value ) { |
|
3983
|
|
|
return bulk.call( jQuery( elem ), value ); |
|
3984
|
|
|
}; |
|
3985
|
|
|
} |
|
3986
|
|
|
} |
|
3987
|
|
|
|
|
3988
|
|
|
if ( fn ) { |
|
3989
|
|
|
for ( ; i < len; i++ ) { |
|
3990
|
|
|
fn( |
|
3991
|
|
|
elems[ i ], key, raw ? |
|
3992
|
|
|
value : |
|
3993
|
|
|
value.call( elems[ i ], i, fn( elems[ i ], key ) ) |
|
3994
|
|
|
); |
|
3995
|
|
|
} |
|
3996
|
|
|
} |
|
3997
|
|
|
} |
|
3998
|
|
|
|
|
3999
|
|
|
if ( chainable ) { |
|
4000
|
|
|
return elems; |
|
4001
|
|
|
} |
|
4002
|
|
|
|
|
4003
|
|
|
// Gets |
|
4004
|
|
|
if ( bulk ) { |
|
4005
|
|
|
return fn.call( elems ); |
|
4006
|
|
|
} |
|
4007
|
|
|
|
|
4008
|
|
|
return len ? fn( elems[ 0 ], key ) : emptyGet; |
|
4009
|
|
|
}; |
|
4010
|
|
|
var acceptData = function( owner ) { |
|
4011
|
|
|
|
|
4012
|
|
|
// Accepts only: |
|
4013
|
|
|
// - Node |
|
4014
|
|
|
// - Node.ELEMENT_NODE |
|
4015
|
|
|
// - Node.DOCUMENT_NODE |
|
4016
|
|
|
// - Object |
|
4017
|
|
|
// - Any |
|
4018
|
|
|
return owner.nodeType === 1 || owner.nodeType === 9 || !( +owner.nodeType ); |
|
4019
|
|
|
}; |
|
4020
|
|
|
|
|
4021
|
|
|
|
|
4022
|
|
|
|
|
4023
|
|
|
|
|
4024
|
|
|
function Data() { |
|
4025
|
|
|
this.expando = jQuery.expando + Data.uid++; |
|
4026
|
|
|
} |
|
4027
|
|
|
|
|
4028
|
|
|
Data.uid = 1; |
|
4029
|
|
|
|
|
4030
|
|
|
Data.prototype = { |
|
4031
|
|
|
|
|
4032
|
|
|
cache: function( owner ) { |
|
4033
|
|
|
|
|
4034
|
|
|
// Check if the owner object already has a cache |
|
4035
|
|
|
var value = owner[ this.expando ]; |
|
4036
|
|
|
|
|
4037
|
|
|
// If not, create one |
|
4038
|
|
|
if ( !value ) { |
|
4039
|
|
|
value = {}; |
|
4040
|
|
|
|
|
4041
|
|
|
// We can accept data for non-element nodes in modern browsers, |
|
4042
|
|
|
// but we should not, see #8335. |
|
4043
|
|
|
// Always return an empty object. |
|
4044
|
|
|
if ( acceptData( owner ) ) { |
|
4045
|
|
|
|
|
4046
|
|
|
// If it is a node unlikely to be stringify-ed or looped over |
|
4047
|
|
|
// use plain assignment |
|
4048
|
|
|
if ( owner.nodeType ) { |
|
4049
|
|
|
owner[ this.expando ] = value; |
|
4050
|
|
|
|
|
4051
|
|
|
// Otherwise secure it in a non-enumerable property |
|
4052
|
|
|
// configurable must be true to allow the property to be |
|
4053
|
|
|
// deleted when data is removed |
|
4054
|
|
|
} else { |
|
4055
|
|
|
Object.defineProperty( owner, this.expando, { |
|
4056
|
|
|
value: value, |
|
4057
|
|
|
configurable: true |
|
4058
|
|
|
} ); |
|
4059
|
|
|
} |
|
4060
|
|
|
} |
|
4061
|
|
|
} |
|
4062
|
|
|
|
|
4063
|
|
|
return value; |
|
4064
|
|
|
}, |
|
4065
|
|
|
set: function( owner, data, value ) { |
|
4066
|
|
|
var prop, |
|
4067
|
|
|
cache = this.cache( owner ); |
|
4068
|
|
|
|
|
4069
|
|
|
// Handle: [ owner, key, value ] args |
|
4070
|
|
|
// Always use camelCase key (gh-2257) |
|
4071
|
|
|
if ( typeof data === "string" ) { |
|
4072
|
|
|
cache[ jQuery.camelCase( data ) ] = value; |
|
4073
|
|
|
|
|
4074
|
|
|
// Handle: [ owner, { properties } ] args |
|
4075
|
|
|
} else { |
|
4076
|
|
|
|
|
4077
|
|
|
// Copy the properties one-by-one to the cache object |
|
4078
|
|
|
for ( prop in data ) { |
|
4079
|
|
|
cache[ jQuery.camelCase( prop ) ] = data[ prop ]; |
|
4080
|
|
|
} |
|
4081
|
|
|
} |
|
4082
|
|
|
return cache; |
|
4083
|
|
|
}, |
|
4084
|
|
|
get: function( owner, key ) { |
|
4085
|
|
|
return key === undefined ? |
|
4086
|
|
|
this.cache( owner ) : |
|
4087
|
|
|
|
|
4088
|
|
|
// Always use camelCase key (gh-2257) |
|
4089
|
|
|
owner[ this.expando ] && owner[ this.expando ][ jQuery.camelCase( key ) ]; |
|
4090
|
|
|
}, |
|
4091
|
|
|
access: function( owner, key, value ) { |
|
4092
|
|
|
|
|
4093
|
|
|
// In cases where either: |
|
4094
|
|
|
// |
|
4095
|
|
|
// 1. No key was specified |
|
4096
|
|
|
// 2. A string key was specified, but no value provided |
|
4097
|
|
|
// |
|
4098
|
|
|
// Take the "read" path and allow the get method to determine |
|
4099
|
|
|
// which value to return, respectively either: |
|
4100
|
|
|
// |
|
4101
|
|
|
// 1. The entire cache object |
|
4102
|
|
|
// 2. The data stored at the key |
|
4103
|
|
|
// |
|
4104
|
|
|
if ( key === undefined || |
|
4105
|
|
|
( ( key && typeof key === "string" ) && value === undefined ) ) { |
|
4106
|
|
|
|
|
4107
|
|
|
return this.get( owner, key ); |
|
4108
|
|
|
} |
|
4109
|
|
|
|
|
4110
|
|
|
// When the key is not a string, or both a key and value |
|
4111
|
|
|
// are specified, set or extend (existing objects) with either: |
|
4112
|
|
|
// |
|
4113
|
|
|
// 1. An object of properties |
|
4114
|
|
|
// 2. A key and value |
|
4115
|
|
|
// |
|
4116
|
|
|
this.set( owner, key, value ); |
|
4117
|
|
|
|
|
4118
|
|
|
// Since the "set" path can have two possible entry points |
|
4119
|
|
|
// return the expected data based on which path was taken[*] |
|
4120
|
|
|
return value !== undefined ? value : key; |
|
4121
|
|
|
}, |
|
4122
|
|
|
remove: function( owner, key ) { |
|
4123
|
|
|
var i, |
|
4124
|
|
|
cache = owner[ this.expando ]; |
|
4125
|
|
|
|
|
4126
|
|
|
if ( cache === undefined ) { |
|
4127
|
|
|
return; |
|
4128
|
|
|
} |
|
4129
|
|
|
|
|
4130
|
|
|
if ( key !== undefined ) { |
|
4131
|
|
|
|
|
4132
|
|
|
// Support array or space separated string of keys |
|
4133
|
|
|
if ( jQuery.isArray( key ) ) { |
|
4134
|
|
|
|
|
4135
|
|
|
// If key is an array of keys... |
|
4136
|
|
|
// We always set camelCase keys, so remove that. |
|
4137
|
|
|
key = key.map( jQuery.camelCase ); |
|
4138
|
|
|
} else { |
|
4139
|
|
|
key = jQuery.camelCase( key ); |
|
4140
|
|
|
|
|
4141
|
|
|
// If a key with the spaces exists, use it. |
|
4142
|
|
|
// Otherwise, create an array by matching non-whitespace |
|
4143
|
|
|
key = key in cache ? |
|
4144
|
|
|
[ key ] : |
|
4145
|
|
|
( key.match( rnothtmlwhite ) || [] ); |
|
4146
|
|
|
} |
|
4147
|
|
|
|
|
4148
|
|
|
i = key.length; |
|
4149
|
|
|
|
|
4150
|
|
|
while ( i-- ) { |
|
4151
|
|
|
delete cache[ key[ i ] ]; |
|
4152
|
|
|
} |
|
4153
|
|
|
} |
|
4154
|
|
|
|
|
4155
|
|
|
// Remove the expando if there's no more data |
|
4156
|
|
|
if ( key === undefined || jQuery.isEmptyObject( cache ) ) { |
|
4157
|
|
|
|
|
4158
|
|
|
// Support: Chrome <=35 - 45 |
|
4159
|
|
|
// Webkit & Blink performance suffers when deleting properties |
|
4160
|
|
|
// from DOM nodes, so set to undefined instead |
|
4161
|
|
|
// https://bugs.chromium.org/p/chromium/issues/detail?id=378607 (bug restricted) |
|
4162
|
|
|
if ( owner.nodeType ) { |
|
4163
|
|
|
owner[ this.expando ] = undefined; |
|
4164
|
|
|
} else { |
|
4165
|
|
|
delete owner[ this.expando ]; |
|
4166
|
|
|
} |
|
4167
|
|
|
} |
|
4168
|
|
|
}, |
|
4169
|
|
|
hasData: function( owner ) { |
|
4170
|
|
|
var cache = owner[ this.expando ]; |
|
4171
|
|
|
return cache !== undefined && !jQuery.isEmptyObject( cache ); |
|
4172
|
|
|
} |
|
4173
|
|
|
}; |
|
4174
|
|
|
var dataPriv = new Data(); |
|
4175
|
|
|
|
|
4176
|
|
|
var dataUser = new Data(); |
|
4177
|
|
|
|
|
4178
|
|
|
|
|
4179
|
|
|
|
|
4180
|
|
|
// Implementation Summary |
|
4181
|
|
|
// |
|
4182
|
|
|
// 1. Enforce API surface and semantic compatibility with 1.9.x branch |
|
4183
|
|
|
// 2. Improve the module's maintainability by reducing the storage |
|
4184
|
|
|
// paths to a single mechanism. |
|
4185
|
|
|
// 3. Use the same single mechanism to support "private" and "user" data. |
|
4186
|
|
|
// 4. _Never_ expose "private" data to user code (TODO: Drop _data, _removeData) |
|
4187
|
|
|
// 5. Avoid exposing implementation details on user objects (eg. expando properties) |
|
4188
|
|
|
// 6. Provide a clear path for implementation upgrade to WeakMap in 2014 |
|
4189
|
|
|
|
|
4190
|
|
|
var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/, |
|
4191
|
|
|
rmultiDash = /[A-Z]/g; |
|
4192
|
|
|
|
|
4193
|
|
|
function getData( data ) { |
|
4194
|
|
|
if ( data === "true" ) { |
|
4195
|
|
|
return true; |
|
4196
|
|
|
} |
|
4197
|
|
|
|
|
4198
|
|
|
if ( data === "false" ) { |
|
4199
|
|
|
return false; |
|
4200
|
|
|
} |
|
4201
|
|
|
|
|
4202
|
|
|
if ( data === "null" ) { |
|
4203
|
|
|
return null; |
|
4204
|
|
|
} |
|
4205
|
|
|
|
|
4206
|
|
|
// Only convert to a number if it doesn't change the string |
|
4207
|
|
|
if ( data === +data + "" ) { |
|
4208
|
|
|
return +data; |
|
4209
|
|
|
} |
|
4210
|
|
|
|
|
4211
|
|
|
if ( rbrace.test( data ) ) { |
|
4212
|
|
|
return JSON.parse( data ); |
|
4213
|
|
|
} |
|
4214
|
|
|
|
|
4215
|
|
|
return data; |
|
4216
|
|
|
} |
|
4217
|
|
|
|
|
4218
|
|
|
function dataAttr( elem, key, data ) { |
|
4219
|
|
|
var name; |
|
4220
|
|
|
|
|
4221
|
|
|
// If nothing was found internally, try to fetch any |
|
4222
|
|
|
// data from the HTML5 data-* attribute |
|
4223
|
|
|
if ( data === undefined && elem.nodeType === 1 ) { |
|
4224
|
|
|
name = "data-" + key.replace( rmultiDash, "-$&" ).toLowerCase(); |
|
4225
|
|
|
data = elem.getAttribute( name ); |
|
4226
|
|
|
|
|
4227
|
|
|
if ( typeof data === "string" ) { |
|
4228
|
|
|
try { |
|
4229
|
|
|
data = getData( data ); |
|
4230
|
|
|
} catch ( e ) {} |
|
4231
|
|
|
|
|
4232
|
|
|
// Make sure we set the data so it isn't changed later |
|
4233
|
|
|
dataUser.set( elem, key, data ); |
|
4234
|
|
|
} else { |
|
4235
|
|
|
data = undefined; |
|
4236
|
|
|
} |
|
4237
|
|
|
} |
|
4238
|
|
|
return data; |
|
4239
|
|
|
} |
|
4240
|
|
|
|
|
4241
|
|
|
jQuery.extend( { |
|
4242
|
|
|
hasData: function( elem ) { |
|
4243
|
|
|
return dataUser.hasData( elem ) || dataPriv.hasData( elem ); |
|
4244
|
|
|
}, |
|
4245
|
|
|
|
|
4246
|
|
|
data: function( elem, name, data ) { |
|
4247
|
|
|
return dataUser.access( elem, name, data ); |
|
4248
|
|
|
}, |
|
4249
|
|
|
|
|
4250
|
|
|
removeData: function( elem, name ) { |
|
4251
|
|
|
dataUser.remove( elem, name ); |
|
4252
|
|
|
}, |
|
4253
|
|
|
|
|
4254
|
|
|
// TODO: Now that all calls to _data and _removeData have been replaced |
|
4255
|
|
|
// with direct calls to dataPriv methods, these can be deprecated. |
|
4256
|
|
|
_data: function( elem, name, data ) { |
|
4257
|
|
|
return dataPriv.access( elem, name, data ); |
|
4258
|
|
|
}, |
|
4259
|
|
|
|
|
4260
|
|
|
_removeData: function( elem, name ) { |
|
4261
|
|
|
dataPriv.remove( elem, name ); |
|
4262
|
|
|
} |
|
4263
|
|
|
} ); |
|
4264
|
|
|
|
|
4265
|
|
|
jQuery.fn.extend( { |
|
4266
|
|
|
data: function( key, value ) { |
|
4267
|
|
|
var i, name, data, |
|
4268
|
|
|
elem = this[ 0 ], |
|
4269
|
|
|
attrs = elem && elem.attributes; |
|
4270
|
|
|
|
|
4271
|
|
|
// Gets all values |
|
4272
|
|
|
if ( key === undefined ) { |
|
4273
|
|
|
if ( this.length ) { |
|
4274
|
|
|
data = dataUser.get( elem ); |
|
4275
|
|
|
|
|
4276
|
|
|
if ( elem.nodeType === 1 && !dataPriv.get( elem, "hasDataAttrs" ) ) { |
|
4277
|
|
|
i = attrs.length; |
|
4278
|
|
|
while ( i-- ) { |
|
4279
|
|
|
|
|
4280
|
|
|
// Support: IE 11 only |
|
4281
|
|
|
// The attrs elements can be null (#14894) |
|
4282
|
|
|
if ( attrs[ i ] ) { |
|
4283
|
|
|
name = attrs[ i ].name; |
|
4284
|
|
|
if ( name.indexOf( "data-" ) === 0 ) { |
|
4285
|
|
|
name = jQuery.camelCase( name.slice( 5 ) ); |
|
4286
|
|
|
dataAttr( elem, name, data[ name ] ); |
|
4287
|
|
|
} |
|
4288
|
|
|
} |
|
4289
|
|
|
} |
|
4290
|
|
|
dataPriv.set( elem, "hasDataAttrs", true ); |
|
4291
|
|
|
} |
|
4292
|
|
|
} |
|
4293
|
|
|
|
|
4294
|
|
|
return data; |
|
4295
|
|
|
} |
|
4296
|
|
|
|
|
4297
|
|
|
// Sets multiple values |
|
4298
|
|
|
if ( typeof key === "object" ) { |
|
4299
|
|
|
return this.each( function() { |
|
4300
|
|
|
dataUser.set( this, key ); |
|
4301
|
|
|
} ); |
|
4302
|
|
|
} |
|
4303
|
|
|
|
|
4304
|
|
|
return access( this, function( value ) { |
|
4305
|
|
|
var data; |
|
4306
|
|
|
|
|
4307
|
|
|
// The calling jQuery object (element matches) is not empty |
|
4308
|
|
|
// (and therefore has an element appears at this[ 0 ]) and the |
|
4309
|
|
|
// `value` parameter was not undefined. An empty jQuery object |
|
4310
|
|
|
// will result in `undefined` for elem = this[ 0 ] which will |
|
4311
|
|
|
// throw an exception if an attempt to read a data cache is made. |
|
4312
|
|
|
if ( elem && value === undefined ) { |
|
4313
|
|
|
|
|
4314
|
|
|
// Attempt to get data from the cache |
|
4315
|
|
|
// The key will always be camelCased in Data |
|
4316
|
|
|
data = dataUser.get( elem, key ); |
|
4317
|
|
|
if ( data !== undefined ) { |
|
4318
|
|
|
return data; |
|
4319
|
|
|
} |
|
4320
|
|
|
|
|
4321
|
|
|
// Attempt to "discover" the data in |
|
4322
|
|
|
// HTML5 custom data-* attrs |
|
4323
|
|
|
data = dataAttr( elem, key ); |
|
4324
|
|
|
if ( data !== undefined ) { |
|
4325
|
|
|
return data; |
|
4326
|
|
|
} |
|
4327
|
|
|
|
|
4328
|
|
|
// We tried really hard, but the data doesn't exist. |
|
4329
|
|
|
return; |
|
4330
|
|
|
} |
|
4331
|
|
|
|
|
4332
|
|
|
// Set the data... |
|
4333
|
|
|
this.each( function() { |
|
4334
|
|
|
|
|
4335
|
|
|
// We always store the camelCased key |
|
4336
|
|
|
dataUser.set( this, key, value ); |
|
4337
|
|
|
} ); |
|
4338
|
|
|
}, null, value, arguments.length > 1, null, true ); |
|
4339
|
|
|
}, |
|
4340
|
|
|
|
|
4341
|
|
|
removeData: function( key ) { |
|
4342
|
|
|
return this.each( function() { |
|
4343
|
|
|
dataUser.remove( this, key ); |
|
4344
|
|
|
} ); |
|
4345
|
|
|
} |
|
4346
|
|
|
} ); |
|
4347
|
|
|
|
|
4348
|
|
|
|
|
4349
|
|
|
jQuery.extend( { |
|
4350
|
|
|
queue: function( elem, type, data ) { |
|
4351
|
|
|
var queue; |
|
4352
|
|
|
|
|
4353
|
|
|
if ( elem ) { |
|
4354
|
|
|
type = ( type || "fx" ) + "queue"; |
|
4355
|
|
|
queue = dataPriv.get( elem, type ); |
|
4356
|
|
|
|
|
4357
|
|
|
// Speed up dequeue by getting out quickly if this is just a lookup |
|
4358
|
|
|
if ( data ) { |
|
4359
|
|
|
if ( !queue || jQuery.isArray( data ) ) { |
|
4360
|
|
|
queue = dataPriv.access( elem, type, jQuery.makeArray( data ) ); |
|
4361
|
|
|
} else { |
|
4362
|
|
|
queue.push( data ); |
|
4363
|
|
|
} |
|
4364
|
|
|
} |
|
4365
|
|
|
return queue || []; |
|
4366
|
|
|
} |
|
4367
|
|
|
}, |
|
4368
|
|
|
|
|
4369
|
|
|
dequeue: function( elem, type ) { |
|
4370
|
|
|
type = type || "fx"; |
|
4371
|
|
|
|
|
4372
|
|
|
var queue = jQuery.queue( elem, type ), |
|
4373
|
|
|
startLength = queue.length, |
|
4374
|
|
|
fn = queue.shift(), |
|
4375
|
|
|
hooks = jQuery._queueHooks( elem, type ), |
|
4376
|
|
|
next = function() { |
|
4377
|
|
|
jQuery.dequeue( elem, type ); |
|
4378
|
|
|
}; |
|
4379
|
|
|
|
|
4380
|
|
|
// If the fx queue is dequeued, always remove the progress sentinel |
|
4381
|
|
|
if ( fn === "inprogress" ) { |
|
4382
|
|
|
fn = queue.shift(); |
|
4383
|
|
|
startLength--; |
|
4384
|
|
|
} |
|
4385
|
|
|
|
|
4386
|
|
|
if ( fn ) { |
|
4387
|
|
|
|
|
4388
|
|
|
// Add a progress sentinel to prevent the fx queue from being |
|
4389
|
|
|
// automatically dequeued |
|
4390
|
|
|
if ( type === "fx" ) { |
|
4391
|
|
|
queue.unshift( "inprogress" ); |
|
4392
|
|
|
} |
|
4393
|
|
|
|
|
4394
|
|
|
// Clear up the last queue stop function |
|
4395
|
|
|
delete hooks.stop; |
|
4396
|
|
|
fn.call( elem, next, hooks ); |
|
4397
|
|
|
} |
|
4398
|
|
|
|
|
4399
|
|
|
if ( !startLength && hooks ) { |
|
4400
|
|
|
hooks.empty.fire(); |
|
4401
|
|
|
} |
|
4402
|
|
|
}, |
|
4403
|
|
|
|
|
4404
|
|
|
// Not public - generate a queueHooks object, or return the current one |
|
4405
|
|
|
_queueHooks: function( elem, type ) { |
|
4406
|
|
|
var key = type + "queueHooks"; |
|
4407
|
|
|
return dataPriv.get( elem, key ) || dataPriv.access( elem, key, { |
|
4408
|
|
|
empty: jQuery.Callbacks( "once memory" ).add( function() { |
|
4409
|
|
|
dataPriv.remove( elem, [ type + "queue", key ] ); |
|
4410
|
|
|
} ) |
|
4411
|
|
|
} ); |
|
4412
|
|
|
} |
|
4413
|
|
|
} ); |
|
4414
|
|
|
|
|
4415
|
|
|
jQuery.fn.extend( { |
|
4416
|
|
|
queue: function( type, data ) { |
|
4417
|
|
|
var setter = 2; |
|
4418
|
|
|
|
|
4419
|
|
|
if ( typeof type !== "string" ) { |
|
4420
|
|
|
data = type; |
|
4421
|
|
|
type = "fx"; |
|
4422
|
|
|
setter--; |
|
4423
|
|
|
} |
|
4424
|
|
|
|
|
4425
|
|
|
if ( arguments.length < setter ) { |
|
4426
|
|
|
return jQuery.queue( this[ 0 ], type ); |
|
4427
|
|
|
} |
|
4428
|
|
|
|
|
4429
|
|
|
return data === undefined ? |
|
4430
|
|
|
this : |
|
4431
|
|
|
this.each( function() { |
|
4432
|
|
|
var queue = jQuery.queue( this, type, data ); |
|
4433
|
|
|
|
|
4434
|
|
|
// Ensure a hooks for this queue |
|
4435
|
|
|
jQuery._queueHooks( this, type ); |
|
4436
|
|
|
|
|
4437
|
|
|
if ( type === "fx" && queue[ 0 ] !== "inprogress" ) { |
|
4438
|
|
|
jQuery.dequeue( this, type ); |
|
4439
|
|
|
} |
|
4440
|
|
|
} ); |
|
4441
|
|
|
}, |
|
4442
|
|
|
dequeue: function( type ) { |
|
4443
|
|
|
return this.each( function() { |
|
4444
|
|
|
jQuery.dequeue( this, type ); |
|
4445
|
|
|
} ); |
|
4446
|
|
|
}, |
|
4447
|
|
|
clearQueue: function( type ) { |
|
4448
|
|
|
return this.queue( type || "fx", [] ); |
|
4449
|
|
|
}, |
|
4450
|
|
|
|
|
4451
|
|
|
// Get a promise resolved when queues of a certain type |
|
4452
|
|
|
// are emptied (fx is the type by default) |
|
4453
|
|
|
promise: function( type, obj ) { |
|
4454
|
|
|
var tmp, |
|
4455
|
|
|
count = 1, |
|
4456
|
|
|
defer = jQuery.Deferred(), |
|
4457
|
|
|
elements = this, |
|
4458
|
|
|
i = this.length, |
|
4459
|
|
|
resolve = function() { |
|
4460
|
|
|
if ( !( --count ) ) { |
|
4461
|
|
|
defer.resolveWith( elements, [ elements ] ); |
|
4462
|
|
|
} |
|
4463
|
|
|
}; |
|
4464
|
|
|
|
|
4465
|
|
|
if ( typeof type !== "string" ) { |
|
4466
|
|
|
obj = type; |
|
4467
|
|
|
type = undefined; |
|
4468
|
|
|
} |
|
4469
|
|
|
type = type || "fx"; |
|
4470
|
|
|
|
|
4471
|
|
|
while ( i-- ) { |
|
4472
|
|
|
tmp = dataPriv.get( elements[ i ], type + "queueHooks" ); |
|
4473
|
|
|
if ( tmp && tmp.empty ) { |
|
4474
|
|
|
count++; |
|
4475
|
|
|
tmp.empty.add( resolve ); |
|
4476
|
|
|
} |
|
4477
|
|
|
} |
|
4478
|
|
|
resolve(); |
|
4479
|
|
|
return defer.promise( obj ); |
|
4480
|
|
|
} |
|
4481
|
|
|
} ); |
|
4482
|
|
|
var pnum = ( /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/ ).source; |
|
4483
|
|
|
|
|
4484
|
|
|
var rcssNum = new RegExp( "^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i" ); |
|
4485
|
|
|
|
|
4486
|
|
|
|
|
4487
|
|
|
var cssExpand = [ "Top", "Right", "Bottom", "Left" ]; |
|
4488
|
|
|
|
|
4489
|
|
|
var isHiddenWithinTree = function( elem, el ) { |
|
4490
|
|
|
|
|
4491
|
|
|
// isHiddenWithinTree might be called from jQuery#filter function; |
|
4492
|
|
|
// in that case, element will be second argument |
|
4493
|
|
|
elem = el || elem; |
|
4494
|
|
|
|
|
4495
|
|
|
// Inline style trumps all |
|
4496
|
|
|
return elem.style.display === "none" || |
|
4497
|
|
|
elem.style.display === "" && |
|
4498
|
|
|
|
|
4499
|
|
|
// Otherwise, check computed style |
|
4500
|
|
|
// Support: Firefox <=43 - 45 |
|
4501
|
|
|
// Disconnected elements can have computed display: none, so first confirm that elem is |
|
4502
|
|
|
// in the document. |
|
4503
|
|
|
jQuery.contains( elem.ownerDocument, elem ) && |
|
4504
|
|
|
|
|
4505
|
|
|
jQuery.css( elem, "display" ) === "none"; |
|
4506
|
|
|
}; |
|
4507
|
|
|
|
|
4508
|
|
|
var swap = function( elem, options, callback, args ) { |
|
4509
|
|
|
var ret, name, |
|
4510
|
|
|
old = {}; |
|
4511
|
|
|
|
|
4512
|
|
|
// Remember the old values, and insert the new ones |
|
4513
|
|
|
for ( name in options ) { |
|
4514
|
|
|
old[ name ] = elem.style[ name ]; |
|
4515
|
|
|
elem.style[ name ] = options[ name ]; |
|
4516
|
|
|
} |
|
4517
|
|
|
|
|
4518
|
|
|
ret = callback.apply( elem, args || [] ); |
|
4519
|
|
|
|
|
4520
|
|
|
// Revert the old values |
|
4521
|
|
|
for ( name in options ) { |
|
4522
|
|
|
elem.style[ name ] = old[ name ]; |
|
4523
|
|
|
} |
|
4524
|
|
|
|
|
4525
|
|
|
return ret; |
|
4526
|
|
|
}; |
|
4527
|
|
|
|
|
4528
|
|
|
|
|
4529
|
|
|
|
|
4530
|
|
|
|
|
4531
|
|
|
function adjustCSS( elem, prop, valueParts, tween ) { |
|
4532
|
|
|
var adjusted, |
|
4533
|
|
|
scale = 1, |
|
4534
|
|
|
maxIterations = 20, |
|
4535
|
|
|
currentValue = tween ? |
|
4536
|
|
|
function() { |
|
4537
|
|
|
return tween.cur(); |
|
4538
|
|
|
} : |
|
4539
|
|
|
function() { |
|
4540
|
|
|
return jQuery.css( elem, prop, "" ); |
|
4541
|
|
|
}, |
|
4542
|
|
|
initial = currentValue(), |
|
4543
|
|
|
unit = valueParts && valueParts[ 3 ] || ( jQuery.cssNumber[ prop ] ? "" : "px" ), |
|
4544
|
|
|
|
|
4545
|
|
|
// Starting value computation is required for potential unit mismatches |
|
4546
|
|
|
initialInUnit = ( jQuery.cssNumber[ prop ] || unit !== "px" && +initial ) && |
|
4547
|
|
|
rcssNum.exec( jQuery.css( elem, prop ) ); |
|
4548
|
|
|
|
|
4549
|
|
|
if ( initialInUnit && initialInUnit[ 3 ] !== unit ) { |
|
4550
|
|
|
|
|
4551
|
|
|
// Trust units reported by jQuery.css |
|
4552
|
|
|
unit = unit || initialInUnit[ 3 ]; |
|
4553
|
|
|
|
|
4554
|
|
|
// Make sure we update the tween properties later on |
|
4555
|
|
|
valueParts = valueParts || []; |
|
4556
|
|
|
|
|
4557
|
|
|
// Iteratively approximate from a nonzero starting point |
|
4558
|
|
|
initialInUnit = +initial || 1; |
|
4559
|
|
|
|
|
4560
|
|
|
do { |
|
4561
|
|
|
|
|
4562
|
|
|
// If previous iteration zeroed out, double until we get *something*. |
|
4563
|
|
|
// Use string for doubling so we don't accidentally see scale as unchanged below |
|
4564
|
|
|
scale = scale || ".5"; |
|
4565
|
|
|
|
|
4566
|
|
|
// Adjust and apply |
|
4567
|
|
|
initialInUnit = initialInUnit / scale; |
|
4568
|
|
|
jQuery.style( elem, prop, initialInUnit + unit ); |
|
4569
|
|
|
|
|
4570
|
|
|
// Update scale, tolerating zero or NaN from tween.cur() |
|
4571
|
|
|
// Break the loop if scale is unchanged or perfect, or if we've just had enough. |
|
4572
|
|
|
} while ( |
|
4573
|
|
|
scale !== ( scale = currentValue() / initial ) && scale !== 1 && --maxIterations |
|
4574
|
|
|
); |
|
4575
|
|
|
} |
|
4576
|
|
|
|
|
4577
|
|
|
if ( valueParts ) { |
|
4578
|
|
|
initialInUnit = +initialInUnit || +initial || 0; |
|
4579
|
|
|
|
|
4580
|
|
|
// Apply relative offset (+=/-=) if specified |
|
4581
|
|
|
adjusted = valueParts[ 1 ] ? |
|
4582
|
|
|
initialInUnit + ( valueParts[ 1 ] + 1 ) * valueParts[ 2 ] : |
|
4583
|
|
|
+valueParts[ 2 ]; |
|
4584
|
|
|
if ( tween ) { |
|
4585
|
|
|
tween.unit = unit; |
|
4586
|
|
|
tween.start = initialInUnit; |
|
4587
|
|
|
tween.end = adjusted; |
|
4588
|
|
|
} |
|
4589
|
|
|
} |
|
4590
|
|
|
return adjusted; |
|
4591
|
|
|
} |
|
4592
|
|
|
|
|
4593
|
|
|
|
|
4594
|
|
|
var defaultDisplayMap = {}; |
|
4595
|
|
|
|
|
4596
|
|
|
function getDefaultDisplay( elem ) { |
|
4597
|
|
|
var temp, |
|
4598
|
|
|
doc = elem.ownerDocument, |
|
4599
|
|
|
nodeName = elem.nodeName, |
|
4600
|
|
|
display = defaultDisplayMap[ nodeName ]; |
|
4601
|
|
|
|
|
4602
|
|
|
if ( display ) { |
|
4603
|
|
|
return display; |
|
4604
|
|
|
} |
|
4605
|
|
|
|
|
4606
|
|
|
temp = doc.body.appendChild( doc.createElement( nodeName ) ); |
|
4607
|
|
|
display = jQuery.css( temp, "display" ); |
|
4608
|
|
|
|
|
4609
|
|
|
temp.parentNode.removeChild( temp ); |
|
4610
|
|
|
|
|
4611
|
|
|
if ( display === "none" ) { |
|
4612
|
|
|
display = "block"; |
|
4613
|
|
|
} |
|
4614
|
|
|
defaultDisplayMap[ nodeName ] = display; |
|
4615
|
|
|
|
|
4616
|
|
|
return display; |
|
4617
|
|
|
} |
|
4618
|
|
|
|
|
4619
|
|
|
function showHide( elements, show ) { |
|
4620
|
|
|
var display, elem, |
|
4621
|
|
|
values = [], |
|
4622
|
|
|
index = 0, |
|
4623
|
|
|
length = elements.length; |
|
4624
|
|
|
|
|
4625
|
|
|
// Determine new display value for elements that need to change |
|
4626
|
|
|
for ( ; index < length; index++ ) { |
|
4627
|
|
|
elem = elements[ index ]; |
|
4628
|
|
|
if ( !elem.style ) { |
|
4629
|
|
|
continue; |
|
4630
|
|
|
} |
|
4631
|
|
|
|
|
4632
|
|
|
display = elem.style.display; |
|
4633
|
|
|
if ( show ) { |
|
4634
|
|
|
|
|
4635
|
|
|
// Since we force visibility upon cascade-hidden elements, an immediate (and slow) |
|
4636
|
|
|
// check is required in this first loop unless we have a nonempty display value (either |
|
4637
|
|
|
// inline or about-to-be-restored) |
|
4638
|
|
|
if ( display === "none" ) { |
|
4639
|
|
|
values[ index ] = dataPriv.get( elem, "display" ) || null; |
|
4640
|
|
|
if ( !values[ index ] ) { |
|
4641
|
|
|
elem.style.display = ""; |
|
4642
|
|
|
} |
|
4643
|
|
|
} |
|
4644
|
|
|
if ( elem.style.display === "" && isHiddenWithinTree( elem ) ) { |
|
4645
|
|
|
values[ index ] = getDefaultDisplay( elem ); |
|
4646
|
|
|
} |
|
4647
|
|
|
} else { |
|
4648
|
|
|
if ( display !== "none" ) { |
|
4649
|
|
|
values[ index ] = "none"; |
|
4650
|
|
|
|
|
4651
|
|
|
// Remember what we're overwriting |
|
4652
|
|
|
dataPriv.set( elem, "display", display ); |
|
4653
|
|
|
} |
|
4654
|
|
|
} |
|
4655
|
|
|
} |
|
4656
|
|
|
|
|
4657
|
|
|
// Set the display of the elements in a second loop to avoid constant reflow |
|
4658
|
|
|
for ( index = 0; index < length; index++ ) { |
|
4659
|
|
|
if ( values[ index ] != null ) { |
|
4660
|
|
|
elements[ index ].style.display = values[ index ]; |
|
4661
|
|
|
} |
|
4662
|
|
|
} |
|
4663
|
|
|
|
|
4664
|
|
|
return elements; |
|
4665
|
|
|
} |
|
4666
|
|
|
|
|
4667
|
|
|
jQuery.fn.extend( { |
|
4668
|
|
|
show: function() { |
|
4669
|
|
|
return showHide( this, true ); |
|
4670
|
|
|
}, |
|
4671
|
|
|
hide: function() { |
|
4672
|
|
|
return showHide( this ); |
|
4673
|
|
|
}, |
|
4674
|
|
|
toggle: function( state ) { |
|
4675
|
|
|
if ( typeof state === "boolean" ) { |
|
4676
|
|
|
return state ? this.show() : this.hide(); |
|
4677
|
|
|
} |
|
4678
|
|
|
|
|
4679
|
|
|
return this.each( function() { |
|
4680
|
|
|
if ( isHiddenWithinTree( this ) ) { |
|
4681
|
|
|
jQuery( this ).show(); |
|
4682
|
|
|
} else { |
|
4683
|
|
|
jQuery( this ).hide(); |
|
4684
|
|
|
} |
|
4685
|
|
|
} ); |
|
4686
|
|
|
} |
|
4687
|
|
|
} ); |
|
4688
|
|
|
var rcheckableType = ( /^(?:checkbox|radio)$/i ); |
|
4689
|
|
|
|
|
4690
|
|
|
var rtagName = ( /<([a-z][^\/\0>\x20\t\r\n\f]+)/i ); |
|
4691
|
|
|
|
|
4692
|
|
|
var rscriptType = ( /^$|\/(?:java|ecma)script/i ); |
|
4693
|
|
|
|
|
4694
|
|
|
|
|
4695
|
|
|
|
|
4696
|
|
|
// We have to close these tags to support XHTML (#13200) |
|
4697
|
|
|
var wrapMap = { |
|
4698
|
|
|
|
|
4699
|
|
|
// Support: IE <=9 only |
|
4700
|
|
|
option: [ 1, "<select multiple='multiple'>", "</select>" ], |
|
4701
|
|
|
|
|
4702
|
|
|
// XHTML parsers do not magically insert elements in the |
|
4703
|
|
|
// same way that tag soup parsers do. So we cannot shorten |
|
4704
|
|
|
// this by omitting <tbody> or other required elements. |
|
4705
|
|
|
thead: [ 1, "<table>", "</table>" ], |
|
4706
|
|
|
col: [ 2, "<table><colgroup>", "</colgroup></table>" ], |
|
4707
|
|
|
tr: [ 2, "<table><tbody>", "</tbody></table>" ], |
|
4708
|
|
|
td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ], |
|
4709
|
|
|
|
|
4710
|
|
|
_default: [ 0, "", "" ] |
|
4711
|
|
|
}; |
|
4712
|
|
|
|
|
4713
|
|
|
// Support: IE <=9 only |
|
4714
|
|
|
wrapMap.optgroup = wrapMap.option; |
|
4715
|
|
|
|
|
4716
|
|
|
wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead; |
|
4717
|
|
|
wrapMap.th = wrapMap.td; |
|
4718
|
|
|
|
|
4719
|
|
|
|
|
4720
|
|
|
function getAll( context, tag ) { |
|
4721
|
|
|
|
|
4722
|
|
|
// Support: IE <=9 - 11 only |
|
4723
|
|
|
// Use typeof to avoid zero-argument method invocation on host objects (#15151) |
|
4724
|
|
|
var ret; |
|
4725
|
|
|
|
|
4726
|
|
|
if ( typeof context.getElementsByTagName !== "undefined" ) { |
|
4727
|
|
|
ret = context.getElementsByTagName( tag || "*" ); |
|
4728
|
|
|
|
|
4729
|
|
|
} else if ( typeof context.querySelectorAll !== "undefined" ) { |
|
4730
|
|
|
ret = context.querySelectorAll( tag || "*" ); |
|
4731
|
|
|
|
|
4732
|
|
|
} else { |
|
4733
|
|
|
ret = []; |
|
4734
|
|
|
} |
|
4735
|
|
|
|
|
4736
|
|
|
if ( tag === undefined || tag && jQuery.nodeName( context, tag ) ) { |
|
4737
|
|
|
return jQuery.merge( [ context ], ret ); |
|
4738
|
|
|
} |
|
4739
|
|
|
|
|
4740
|
|
|
return ret; |
|
4741
|
|
|
} |
|
4742
|
|
|
|
|
4743
|
|
|
|
|
4744
|
|
|
// Mark scripts as having already been evaluated |
|
4745
|
|
|
function setGlobalEval( elems, refElements ) { |
|
4746
|
|
|
var i = 0, |
|
4747
|
|
|
l = elems.length; |
|
4748
|
|
|
|
|
4749
|
|
|
for ( ; i < l; i++ ) { |
|
4750
|
|
|
dataPriv.set( |
|
4751
|
|
|
elems[ i ], |
|
4752
|
|
|
"globalEval", |
|
4753
|
|
|
!refElements || dataPriv.get( refElements[ i ], "globalEval" ) |
|
4754
|
|
|
); |
|
4755
|
|
|
} |
|
4756
|
|
|
} |
|
4757
|
|
|
|
|
4758
|
|
|
|
|
4759
|
|
|
var rhtml = /<|&#?\w+;/; |
|
4760
|
|
|
|
|
4761
|
|
|
function buildFragment( elems, context, scripts, selection, ignored ) { |
|
4762
|
|
|
var elem, tmp, tag, wrap, contains, j, |
|
4763
|
|
|
fragment = context.createDocumentFragment(), |
|
4764
|
|
|
nodes = [], |
|
4765
|
|
|
i = 0, |
|
4766
|
|
|
l = elems.length; |
|
4767
|
|
|
|
|
4768
|
|
|
for ( ; i < l; i++ ) { |
|
4769
|
|
|
elem = elems[ i ]; |
|
4770
|
|
|
|
|
4771
|
|
|
if ( elem || elem === 0 ) { |
|
4772
|
|
|
|
|
4773
|
|
|
// Add nodes directly |
|
4774
|
|
|
if ( jQuery.type( elem ) === "object" ) { |
|
4775
|
|
|
|
|
4776
|
|
|
// Support: Android <=4.0 only, PhantomJS 1 only |
|
4777
|
|
|
// push.apply(_, arraylike) throws on ancient WebKit |
|
4778
|
|
|
jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem ); |
|
4779
|
|
|
|
|
4780
|
|
|
// Convert non-html into a text node |
|
4781
|
|
|
} else if ( !rhtml.test( elem ) ) { |
|
4782
|
|
|
nodes.push( context.createTextNode( elem ) ); |
|
4783
|
|
|
|
|
4784
|
|
|
// Convert html into DOM nodes |
|
4785
|
|
|
} else { |
|
4786
|
|
|
tmp = tmp || fragment.appendChild( context.createElement( "div" ) ); |
|
4787
|
|
|
|
|
4788
|
|
|
// Deserialize a standard representation |
|
4789
|
|
|
tag = ( rtagName.exec( elem ) || [ "", "" ] )[ 1 ].toLowerCase(); |
|
4790
|
|
|
wrap = wrapMap[ tag ] || wrapMap._default; |
|
4791
|
|
|
tmp.innerHTML = wrap[ 1 ] + jQuery.htmlPrefilter( elem ) + wrap[ 2 ]; |
|
4792
|
|
|
|
|
4793
|
|
|
// Descend through wrappers to the right content |
|
4794
|
|
|
j = wrap[ 0 ]; |
|
4795
|
|
|
while ( j-- ) { |
|
4796
|
|
|
tmp = tmp.lastChild; |
|
4797
|
|
|
} |
|
4798
|
|
|
|
|
4799
|
|
|
// Support: Android <=4.0 only, PhantomJS 1 only |
|
4800
|
|
|
// push.apply(_, arraylike) throws on ancient WebKit |
|
4801
|
|
|
jQuery.merge( nodes, tmp.childNodes ); |
|
4802
|
|
|
|
|
4803
|
|
|
// Remember the top-level container |
|
4804
|
|
|
tmp = fragment.firstChild; |
|
4805
|
|
|
|
|
4806
|
|
|
// Ensure the created nodes are orphaned (#12392) |
|
4807
|
|
|
tmp.textContent = ""; |
|
4808
|
|
|
} |
|
4809
|
|
|
} |
|
4810
|
|
|
} |
|
4811
|
|
|
|
|
4812
|
|
|
// Remove wrapper from fragment |
|
4813
|
|
|
fragment.textContent = ""; |
|
4814
|
|
|
|
|
4815
|
|
|
i = 0; |
|
4816
|
|
|
while ( ( elem = nodes[ i++ ] ) ) { |
|
4817
|
|
|
|
|
4818
|
|
|
// Skip elements already in the context collection (trac-4087) |
|
4819
|
|
|
if ( selection && jQuery.inArray( elem, selection ) > -1 ) { |
|
4820
|
|
|
if ( ignored ) { |
|
4821
|
|
|
ignored.push( elem ); |
|
4822
|
|
|
} |
|
4823
|
|
|
continue; |
|
4824
|
|
|
} |
|
4825
|
|
|
|
|
4826
|
|
|
contains = jQuery.contains( elem.ownerDocument, elem ); |
|
4827
|
|
|
|
|
4828
|
|
|
// Append to fragment |
|
4829
|
|
|
tmp = getAll( fragment.appendChild( elem ), "script" ); |
|
4830
|
|
|
|
|
4831
|
|
|
// Preserve script evaluation history |
|
4832
|
|
|
if ( contains ) { |
|
4833
|
|
|
setGlobalEval( tmp ); |
|
4834
|
|
|
} |
|
4835
|
|
|
|
|
4836
|
|
|
// Capture executables |
|
4837
|
|
|
if ( scripts ) { |
|
4838
|
|
|
j = 0; |
|
4839
|
|
|
while ( ( elem = tmp[ j++ ] ) ) { |
|
4840
|
|
|
if ( rscriptType.test( elem.type || "" ) ) { |
|
4841
|
|
|
scripts.push( elem ); |
|
4842
|
|
|
} |
|
4843
|
|
|
} |
|
4844
|
|
|
} |
|
4845
|
|
|
} |
|
4846
|
|
|
|
|
4847
|
|
|
return fragment; |
|
4848
|
|
|
} |
|
4849
|
|
|
|
|
4850
|
|
|
|
|
4851
|
|
|
( function() { |
|
4852
|
|
|
var fragment = document.createDocumentFragment(), |
|
4853
|
|
|
div = fragment.appendChild( document.createElement( "div" ) ), |
|
4854
|
|
|
input = document.createElement( "input" ); |
|
4855
|
|
|
|
|
4856
|
|
|
// Support: Android 4.0 - 4.3 only |
|
4857
|
|
|
// Check state lost if the name is set (#11217) |
|
4858
|
|
|
// Support: Windows Web Apps (WWA) |
|
4859
|
|
|
// `name` and `type` must use .setAttribute for WWA (#14901) |
|
4860
|
|
|
input.setAttribute( "type", "radio" ); |
|
4861
|
|
|
input.setAttribute( "checked", "checked" ); |
|
4862
|
|
|
input.setAttribute( "name", "t" ); |
|
4863
|
|
|
|
|
4864
|
|
|
div.appendChild( input ); |
|
4865
|
|
|
|
|
4866
|
|
|
// Support: Android <=4.1 only |
|
4867
|
|
|
// Older WebKit doesn't clone checked state correctly in fragments |
|
4868
|
|
|
support.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.checked; |
|
4869
|
|
|
|
|
4870
|
|
|
// Support: IE <=11 only |
|
4871
|
|
|
// Make sure textarea (and checkbox) defaultValue is properly cloned |
|
4872
|
|
|
div.innerHTML = "<textarea>x</textarea>"; |
|
4873
|
|
|
support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue; |
|
4874
|
|
|
} )(); |
|
4875
|
|
|
var documentElement = document.documentElement; |
|
4876
|
|
|
|
|
4877
|
|
|
|
|
4878
|
|
|
|
|
4879
|
|
|
var |
|
4880
|
|
|
rkeyEvent = /^key/, |
|
4881
|
|
|
rmouseEvent = /^(?:mouse|pointer|contextmenu|drag|drop)|click/, |
|
4882
|
|
|
rtypenamespace = /^([^.]*)(?:\.(.+)|)/; |
|
4883
|
|
|
|
|
4884
|
|
|
function returnTrue() { |
|
4885
|
|
|
return true; |
|
4886
|
|
|
} |
|
4887
|
|
|
|
|
4888
|
|
|
function returnFalse() { |
|
4889
|
|
|
return false; |
|
4890
|
|
|
} |
|
4891
|
|
|
|
|
4892
|
|
|
// Support: IE <=9 only |
|
4893
|
|
|
// See #13393 for more info |
|
4894
|
|
|
function safeActiveElement() { |
|
4895
|
|
|
try { |
|
4896
|
|
|
return document.activeElement; |
|
4897
|
|
|
} catch ( err ) { } |
|
4898
|
|
|
} |
|
4899
|
|
|
|
|
4900
|
|
|
function on( elem, types, selector, data, fn, one ) { |
|
4901
|
|
|
var origFn, type; |
|
4902
|
|
|
|
|
4903
|
|
|
// Types can be a map of types/handlers |
|
4904
|
|
|
if ( typeof types === "object" ) { |
|
4905
|
|
|
|
|
4906
|
|
|
// ( types-Object, selector, data ) |
|
4907
|
|
|
if ( typeof selector !== "string" ) { |
|
4908
|
|
|
|
|
4909
|
|
|
// ( types-Object, data ) |
|
4910
|
|
|
data = data || selector; |
|
4911
|
|
|
selector = undefined; |
|
4912
|
|
|
} |
|
4913
|
|
|
for ( type in types ) { |
|
4914
|
|
|
on( elem, type, selector, data, types[ type ], one ); |
|
4915
|
|
|
} |
|
4916
|
|
|
return elem; |
|
4917
|
|
|
} |
|
4918
|
|
|
|
|
4919
|
|
|
if ( data == null && fn == null ) { |
|
4920
|
|
|
|
|
4921
|
|
|
// ( types, fn ) |
|
4922
|
|
|
fn = selector; |
|
4923
|
|
|
data = selector = undefined; |
|
4924
|
|
|
} else if ( fn == null ) { |
|
4925
|
|
|
if ( typeof selector === "string" ) { |
|
4926
|
|
|
|
|
4927
|
|
|
// ( types, selector, fn ) |
|
4928
|
|
|
fn = data; |
|
4929
|
|
|
data = undefined; |
|
4930
|
|
|
} else { |
|
4931
|
|
|
|
|
4932
|
|
|
// ( types, data, fn ) |
|
4933
|
|
|
fn = data; |
|
4934
|
|
|
data = selector; |
|
4935
|
|
|
selector = undefined; |
|
4936
|
|
|
} |
|
4937
|
|
|
} |
|
4938
|
|
|
if ( fn === false ) { |
|
4939
|
|
|
fn = returnFalse; |
|
4940
|
|
|
} else if ( !fn ) { |
|
4941
|
|
|
return elem; |
|
4942
|
|
|
} |
|
4943
|
|
|
|
|
4944
|
|
|
if ( one === 1 ) { |
|
4945
|
|
|
origFn = fn; |
|
4946
|
|
|
fn = function( event ) { |
|
4947
|
|
|
|
|
4948
|
|
|
// Can use an empty set, since event contains the info |
|
4949
|
|
|
jQuery().off( event ); |
|
4950
|
|
|
return origFn.apply( this, arguments ); |
|
4951
|
|
|
}; |
|
4952
|
|
|
|
|
4953
|
|
|
// Use same guid so caller can remove using origFn |
|
4954
|
|
|
fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ ); |
|
4955
|
|
|
} |
|
4956
|
|
|
return elem.each( function() { |
|
4957
|
|
|
jQuery.event.add( this, types, fn, data, selector ); |
|
4958
|
|
|
} ); |
|
4959
|
|
|
} |
|
4960
|
|
|
|
|
4961
|
|
|
/* |
|
4962
|
|
|
* Helper functions for managing events -- not part of the public interface. |
|
4963
|
|
|
* Props to Dean Edwards' addEvent library for many of the ideas. |
|
4964
|
|
|
*/ |
|
4965
|
|
|
jQuery.event = { |
|
4966
|
|
|
|
|
4967
|
|
|
global: {}, |
|
4968
|
|
|
|
|
4969
|
|
|
add: function( elem, types, handler, data, selector ) { |
|
4970
|
|
|
|
|
4971
|
|
|
var handleObjIn, eventHandle, tmp, |
|
4972
|
|
|
events, t, handleObj, |
|
4973
|
|
|
special, handlers, type, namespaces, origType, |
|
4974
|
|
|
elemData = dataPriv.get( elem ); |
|
4975
|
|
|
|
|
4976
|
|
|
// Don't attach events to noData or text/comment nodes (but allow plain objects) |
|
4977
|
|
|
if ( !elemData ) { |
|
4978
|
|
|
return; |
|
4979
|
|
|
} |
|
4980
|
|
|
|
|
4981
|
|
|
// Caller can pass in an object of custom data in lieu of the handler |
|
4982
|
|
|
if ( handler.handler ) { |
|
4983
|
|
|
handleObjIn = handler; |
|
4984
|
|
|
handler = handleObjIn.handler; |
|
4985
|
|
|
selector = handleObjIn.selector; |
|
4986
|
|
|
} |
|
4987
|
|
|
|
|
4988
|
|
|
// Ensure that invalid selectors throw exceptions at attach time |
|
4989
|
|
|
// Evaluate against documentElement in case elem is a non-element node (e.g., document) |
|
4990
|
|
|
if ( selector ) { |
|
4991
|
|
|
jQuery.find.matchesSelector( documentElement, selector ); |
|
4992
|
|
|
} |
|
4993
|
|
|
|
|
4994
|
|
|
// Make sure that the handler has a unique ID, used to find/remove it later |
|
4995
|
|
|
if ( !handler.guid ) { |
|
4996
|
|
|
handler.guid = jQuery.guid++; |
|
4997
|
|
|
} |
|
4998
|
|
|
|
|
4999
|
|
|
// Init the element's event structure and main handler, if this is the first |
|
5000
|
|
|
if ( !( events = elemData.events ) ) { |
|
5001
|
|
|
events = elemData.events = {}; |
|
5002
|
|
|
} |
|
5003
|
|
|
if ( !( eventHandle = elemData.handle ) ) { |
|
5004
|
|
|
eventHandle = elemData.handle = function( e ) { |
|
5005
|
|
|
|
|
5006
|
|
|
// Discard the second event of a jQuery.event.trigger() and |
|
5007
|
|
|
// when an event is called after a page has unloaded |
|
5008
|
|
|
return typeof jQuery !== "undefined" && jQuery.event.triggered !== e.type ? |
|
5009
|
|
|
jQuery.event.dispatch.apply( elem, arguments ) : undefined; |
|
5010
|
|
|
}; |
|
5011
|
|
|
} |
|
5012
|
|
|
|
|
5013
|
|
|
// Handle multiple events separated by a space |
|
5014
|
|
|
types = ( types || "" ).match( rnothtmlwhite ) || [ "" ]; |
|
5015
|
|
|
t = types.length; |
|
5016
|
|
|
while ( t-- ) { |
|
5017
|
|
|
tmp = rtypenamespace.exec( types[ t ] ) || []; |
|
5018
|
|
|
type = origType = tmp[ 1 ]; |
|
5019
|
|
|
namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort(); |
|
5020
|
|
|
|
|
5021
|
|
|
// There *must* be a type, no attaching namespace-only handlers |
|
5022
|
|
|
if ( !type ) { |
|
5023
|
|
|
continue; |
|
5024
|
|
|
} |
|
5025
|
|
|
|
|
5026
|
|
|
// If event changes its type, use the special event handlers for the changed type |
|
5027
|
|
|
special = jQuery.event.special[ type ] || {}; |
|
5028
|
|
|
|
|
5029
|
|
|
// If selector defined, determine special event api type, otherwise given type |
|
5030
|
|
|
type = ( selector ? special.delegateType : special.bindType ) || type; |
|
5031
|
|
|
|
|
5032
|
|
|
// Update special based on newly reset type |
|
5033
|
|
|
special = jQuery.event.special[ type ] || {}; |
|
5034
|
|
|
|
|
5035
|
|
|
// handleObj is passed to all event handlers |
|
5036
|
|
|
handleObj = jQuery.extend( { |
|
5037
|
|
|
type: type, |
|
5038
|
|
|
origType: origType, |
|
5039
|
|
|
data: data, |
|
5040
|
|
|
handler: handler, |
|
5041
|
|
|
guid: handler.guid, |
|
5042
|
|
|
selector: selector, |
|
5043
|
|
|
needsContext: selector && jQuery.expr.match.needsContext.test( selector ), |
|
5044
|
|
|
namespace: namespaces.join( "." ) |
|
5045
|
|
|
}, handleObjIn ); |
|
5046
|
|
|
|
|
5047
|
|
|
// Init the event handler queue if we're the first |
|
5048
|
|
|
if ( !( handlers = events[ type ] ) ) { |
|
5049
|
|
|
handlers = events[ type ] = []; |
|
5050
|
|
|
handlers.delegateCount = 0; |
|
5051
|
|
|
|
|
5052
|
|
|
// Only use addEventListener if the special events handler returns false |
|
5053
|
|
|
if ( !special.setup || |
|
5054
|
|
|
special.setup.call( elem, data, namespaces, eventHandle ) === false ) { |
|
5055
|
|
|
|
|
5056
|
|
|
if ( elem.addEventListener ) { |
|
5057
|
|
|
elem.addEventListener( type, eventHandle ); |
|
5058
|
|
|
} |
|
5059
|
|
|
} |
|
5060
|
|
|
} |
|
5061
|
|
|
|
|
5062
|
|
|
if ( special.add ) { |
|
5063
|
|
|
special.add.call( elem, handleObj ); |
|
5064
|
|
|
|
|
5065
|
|
|
if ( !handleObj.handler.guid ) { |
|
5066
|
|
|
handleObj.handler.guid = handler.guid; |
|
5067
|
|
|
} |
|
5068
|
|
|
} |
|
5069
|
|
|
|
|
5070
|
|
|
// Add to the element's handler list, delegates in front |
|
5071
|
|
|
if ( selector ) { |
|
5072
|
|
|
handlers.splice( handlers.delegateCount++, 0, handleObj ); |
|
5073
|
|
|
} else { |
|
5074
|
|
|
handlers.push( handleObj ); |
|
5075
|
|
|
} |
|
5076
|
|
|
|
|
5077
|
|
|
// Keep track of which events have ever been used, for event optimization |
|
5078
|
|
|
jQuery.event.global[ type ] = true; |
|
5079
|
|
|
} |
|
5080
|
|
|
|
|
5081
|
|
|
}, |
|
5082
|
|
|
|
|
5083
|
|
|
// Detach an event or set of events from an element |
|
5084
|
|
|
remove: function( elem, types, handler, selector, mappedTypes ) { |
|
5085
|
|
|
|
|
5086
|
|
|
var j, origCount, tmp, |
|
5087
|
|
|
events, t, handleObj, |
|
5088
|
|
|
special, handlers, type, namespaces, origType, |
|
5089
|
|
|
elemData = dataPriv.hasData( elem ) && dataPriv.get( elem ); |
|
5090
|
|
|
|
|
5091
|
|
|
if ( !elemData || !( events = elemData.events ) ) { |
|
5092
|
|
|
return; |
|
5093
|
|
|
} |
|
5094
|
|
|
|
|
5095
|
|
|
// Once for each type.namespace in types; type may be omitted |
|
5096
|
|
|
types = ( types || "" ).match( rnothtmlwhite ) || [ "" ]; |
|
5097
|
|
|
t = types.length; |
|
5098
|
|
|
while ( t-- ) { |
|
5099
|
|
|
tmp = rtypenamespace.exec( types[ t ] ) || []; |
|
5100
|
|
|
type = origType = tmp[ 1 ]; |
|
5101
|
|
|
namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort(); |
|
5102
|
|
|
|
|
5103
|
|
|
// Unbind all events (on this namespace, if provided) for the element |
|
5104
|
|
|
if ( !type ) { |
|
5105
|
|
|
for ( type in events ) { |
|
5106
|
|
|
jQuery.event.remove( elem, type + types[ t ], handler, selector, true ); |
|
5107
|
|
|
} |
|
5108
|
|
|
continue; |
|
5109
|
|
|
} |
|
5110
|
|
|
|
|
5111
|
|
|
special = jQuery.event.special[ type ] || {}; |
|
5112
|
|
|
type = ( selector ? special.delegateType : special.bindType ) || type; |
|
5113
|
|
|
handlers = events[ type ] || []; |
|
5114
|
|
|
tmp = tmp[ 2 ] && |
|
5115
|
|
|
new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" ); |
|
5116
|
|
|
|
|
5117
|
|
|
// Remove matching events |
|
5118
|
|
|
origCount = j = handlers.length; |
|
5119
|
|
|
while ( j-- ) { |
|
5120
|
|
|
handleObj = handlers[ j ]; |
|
5121
|
|
|
|
|
5122
|
|
|
if ( ( mappedTypes || origType === handleObj.origType ) && |
|
5123
|
|
|
( !handler || handler.guid === handleObj.guid ) && |
|
5124
|
|
|
( !tmp || tmp.test( handleObj.namespace ) ) && |
|
5125
|
|
|
( !selector || selector === handleObj.selector || |
|
5126
|
|
|
selector === "**" && handleObj.selector ) ) { |
|
5127
|
|
|
handlers.splice( j, 1 ); |
|
5128
|
|
|
|
|
5129
|
|
|
if ( handleObj.selector ) { |
|
5130
|
|
|
handlers.delegateCount--; |
|
5131
|
|
|
} |
|
5132
|
|
|
if ( special.remove ) { |
|
5133
|
|
|
special.remove.call( elem, handleObj ); |
|
5134
|
|
|
} |
|
5135
|
|
|
} |
|
5136
|
|
|
} |
|
5137
|
|
|
|
|
5138
|
|
|
// Remove generic event handler if we removed something and no more handlers exist |
|
5139
|
|
|
// (avoids potential for endless recursion during removal of special event handlers) |
|
5140
|
|
|
if ( origCount && !handlers.length ) { |
|
5141
|
|
|
if ( !special.teardown || |
|
5142
|
|
|
special.teardown.call( elem, namespaces, elemData.handle ) === false ) { |
|
5143
|
|
|
|
|
5144
|
|
|
jQuery.removeEvent( elem, type, elemData.handle ); |
|
5145
|
|
|
} |
|
5146
|
|
|
|
|
5147
|
|
|
delete events[ type ]; |
|
5148
|
|
|
} |
|
5149
|
|
|
} |
|
5150
|
|
|
|
|
5151
|
|
|
// Remove data and the expando if it's no longer used |
|
5152
|
|
|
if ( jQuery.isEmptyObject( events ) ) { |
|
5153
|
|
|
dataPriv.remove( elem, "handle events" ); |
|
5154
|
|
|
} |
|
5155
|
|
|
}, |
|
5156
|
|
|
|
|
5157
|
|
|
dispatch: function( nativeEvent ) { |
|
5158
|
|
|
|
|
5159
|
|
|
// Make a writable jQuery.Event from the native event object |
|
5160
|
|
|
var event = jQuery.event.fix( nativeEvent ); |
|
5161
|
|
|
|
|
5162
|
|
|
var i, j, ret, matched, handleObj, handlerQueue, |
|
5163
|
|
|
args = new Array( arguments.length ), |
|
5164
|
|
|
handlers = ( dataPriv.get( this, "events" ) || {} )[ event.type ] || [], |
|
5165
|
|
|
special = jQuery.event.special[ event.type ] || {}; |
|
5166
|
|
|
|
|
5167
|
|
|
// Use the fix-ed jQuery.Event rather than the (read-only) native event |
|
5168
|
|
|
args[ 0 ] = event; |
|
5169
|
|
|
|
|
5170
|
|
|
for ( i = 1; i < arguments.length; i++ ) { |
|
5171
|
|
|
args[ i ] = arguments[ i ]; |
|
5172
|
|
|
} |
|
5173
|
|
|
|
|
5174
|
|
|
event.delegateTarget = this; |
|
5175
|
|
|
|
|
5176
|
|
|
// Call the preDispatch hook for the mapped type, and let it bail if desired |
|
5177
|
|
|
if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) { |
|
5178
|
|
|
return; |
|
5179
|
|
|
} |
|
5180
|
|
|
|
|
5181
|
|
|
// Determine handlers |
|
5182
|
|
|
handlerQueue = jQuery.event.handlers.call( this, event, handlers ); |
|
5183
|
|
|
|
|
5184
|
|
|
// Run delegates first; they may want to stop propagation beneath us |
|
5185
|
|
|
i = 0; |
|
5186
|
|
|
while ( ( matched = handlerQueue[ i++ ] ) && !event.isPropagationStopped() ) { |
|
5187
|
|
|
event.currentTarget = matched.elem; |
|
5188
|
|
|
|
|
5189
|
|
|
j = 0; |
|
5190
|
|
|
while ( ( handleObj = matched.handlers[ j++ ] ) && |
|
5191
|
|
|
!event.isImmediatePropagationStopped() ) { |
|
5192
|
|
|
|
|
5193
|
|
|
// Triggered event must either 1) have no namespace, or 2) have namespace(s) |
|
5194
|
|
|
// a subset or equal to those in the bound event (both can have no namespace). |
|
5195
|
|
|
if ( !event.rnamespace || event.rnamespace.test( handleObj.namespace ) ) { |
|
5196
|
|
|
|
|
5197
|
|
|
event.handleObj = handleObj; |
|
5198
|
|
|
event.data = handleObj.data; |
|
5199
|
|
|
|
|
5200
|
|
|
ret = ( ( jQuery.event.special[ handleObj.origType ] || {} ).handle || |
|
5201
|
|
|
handleObj.handler ).apply( matched.elem, args ); |
|
5202
|
|
|
|
|
5203
|
|
|
if ( ret !== undefined ) { |
|
5204
|
|
|
if ( ( event.result = ret ) === false ) { |
|
5205
|
|
|
event.preventDefault(); |
|
5206
|
|
|
event.stopPropagation(); |
|
5207
|
|
|
} |
|
5208
|
|
|
} |
|
5209
|
|
|
} |
|
5210
|
|
|
} |
|
5211
|
|
|
} |
|
5212
|
|
|
|
|
5213
|
|
|
// Call the postDispatch hook for the mapped type |
|
5214
|
|
|
if ( special.postDispatch ) { |
|
5215
|
|
|
special.postDispatch.call( this, event ); |
|
5216
|
|
|
} |
|
5217
|
|
|
|
|
5218
|
|
|
return event.result; |
|
5219
|
|
|
}, |
|
5220
|
|
|
|
|
5221
|
|
|
handlers: function( event, handlers ) { |
|
5222
|
|
|
var i, handleObj, sel, matchedHandlers, matchedSelectors, |
|
5223
|
|
|
handlerQueue = [], |
|
5224
|
|
|
delegateCount = handlers.delegateCount, |
|
5225
|
|
|
cur = event.target; |
|
5226
|
|
|
|
|
5227
|
|
|
// Find delegate handlers |
|
5228
|
|
|
if ( delegateCount && |
|
5229
|
|
|
|
|
5230
|
|
|
// Support: IE <=9 |
|
5231
|
|
|
// Black-hole SVG <use> instance trees (trac-13180) |
|
5232
|
|
|
cur.nodeType && |
|
5233
|
|
|
|
|
5234
|
|
|
// Support: Firefox <=42 |
|
5235
|
|
|
// Suppress spec-violating clicks indicating a non-primary pointer button (trac-3861) |
|
5236
|
|
|
// https://www.w3.org/TR/DOM-Level-3-Events/#event-type-click |
|
5237
|
|
|
// Support: IE 11 only |
|
5238
|
|
|
// ...but not arrow key "clicks" of radio inputs, which can have `button` -1 (gh-2343) |
|
5239
|
|
|
!( event.type === "click" && event.button >= 1 ) ) { |
|
5240
|
|
|
|
|
5241
|
|
|
for ( ; cur !== this; cur = cur.parentNode || this ) { |
|
5242
|
|
|
|
|
5243
|
|
|
// Don't check non-elements (#13208) |
|
5244
|
|
|
// Don't process clicks on disabled elements (#6911, #8165, #11382, #11764) |
|
5245
|
|
|
if ( cur.nodeType === 1 && !( event.type === "click" && cur.disabled === true ) ) { |
|
5246
|
|
|
matchedHandlers = []; |
|
5247
|
|
|
matchedSelectors = {}; |
|
5248
|
|
|
for ( i = 0; i < delegateCount; i++ ) { |
|
5249
|
|
|
handleObj = handlers[ i ]; |
|
5250
|
|
|
|
|
5251
|
|
|
// Don't conflict with Object.prototype properties (#13203) |
|
5252
|
|
|
sel = handleObj.selector + " "; |
|
5253
|
|
|
|
|
5254
|
|
|
if ( matchedSelectors[ sel ] === undefined ) { |
|
5255
|
|
|
matchedSelectors[ sel ] = handleObj.needsContext ? |
|
5256
|
|
|
jQuery( sel, this ).index( cur ) > -1 : |
|
5257
|
|
|
jQuery.find( sel, this, null, [ cur ] ).length; |
|
5258
|
|
|
} |
|
5259
|
|
|
if ( matchedSelectors[ sel ] ) { |
|
5260
|
|
|
matchedHandlers.push( handleObj ); |
|
5261
|
|
|
} |
|
5262
|
|
|
} |
|
5263
|
|
|
if ( matchedHandlers.length ) { |
|
5264
|
|
|
handlerQueue.push( { elem: cur, handlers: matchedHandlers } ); |
|
5265
|
|
|
} |
|
5266
|
|
|
} |
|
5267
|
|
|
} |
|
5268
|
|
|
} |
|
5269
|
|
|
|
|
5270
|
|
|
// Add the remaining (directly-bound) handlers |
|
5271
|
|
|
cur = this; |
|
5272
|
|
|
if ( delegateCount < handlers.length ) { |
|
5273
|
|
|
handlerQueue.push( { elem: cur, handlers: handlers.slice( delegateCount ) } ); |
|
5274
|
|
|
} |
|
5275
|
|
|
|
|
5276
|
|
|
return handlerQueue; |
|
5277
|
|
|
}, |
|
5278
|
|
|
|
|
5279
|
|
|
addProp: function( name, hook ) { |
|
5280
|
|
|
Object.defineProperty( jQuery.Event.prototype, name, { |
|
5281
|
|
|
enumerable: true, |
|
5282
|
|
|
configurable: true, |
|
5283
|
|
|
|
|
5284
|
|
|
get: jQuery.isFunction( hook ) ? |
|
5285
|
|
|
function() { |
|
5286
|
|
|
if ( this.originalEvent ) { |
|
5287
|
|
|
return hook( this.originalEvent ); |
|
5288
|
|
|
} |
|
5289
|
|
|
} : |
|
5290
|
|
|
function() { |
|
5291
|
|
|
if ( this.originalEvent ) { |
|
5292
|
|
|
return this.originalEvent[ name ]; |
|
5293
|
|
|
} |
|
5294
|
|
|
}, |
|
5295
|
|
|
|
|
5296
|
|
|
set: function( value ) { |
|
5297
|
|
|
Object.defineProperty( this, name, { |
|
5298
|
|
|
enumerable: true, |
|
5299
|
|
|
configurable: true, |
|
5300
|
|
|
writable: true, |
|
5301
|
|
|
value: value |
|
5302
|
|
|
} ); |
|
5303
|
|
|
} |
|
5304
|
|
|
} ); |
|
5305
|
|
|
}, |
|
5306
|
|
|
|
|
5307
|
|
|
fix: function( originalEvent ) { |
|
5308
|
|
|
return originalEvent[ jQuery.expando ] ? |
|
5309
|
|
|
originalEvent : |
|
5310
|
|
|
new jQuery.Event( originalEvent ); |
|
5311
|
|
|
}, |
|
5312
|
|
|
|
|
5313
|
|
|
special: { |
|
5314
|
|
|
load: { |
|
5315
|
|
|
|
|
5316
|
|
|
// Prevent triggered image.load events from bubbling to window.load |
|
5317
|
|
|
noBubble: true |
|
5318
|
|
|
}, |
|
5319
|
|
|
focus: { |
|
5320
|
|
|
|
|
5321
|
|
|
// Fire native event if possible so blur/focus sequence is correct |
|
5322
|
|
|
trigger: function() { |
|
5323
|
|
|
if ( this !== safeActiveElement() && this.focus ) { |
|
5324
|
|
|
this.focus(); |
|
5325
|
|
|
return false; |
|
5326
|
|
|
} |
|
5327
|
|
|
}, |
|
5328
|
|
|
delegateType: "focusin" |
|
5329
|
|
|
}, |
|
5330
|
|
|
blur: { |
|
5331
|
|
|
trigger: function() { |
|
5332
|
|
|
if ( this === safeActiveElement() && this.blur ) { |
|
5333
|
|
|
this.blur(); |
|
5334
|
|
|
return false; |
|
5335
|
|
|
} |
|
5336
|
|
|
}, |
|
5337
|
|
|
delegateType: "focusout" |
|
5338
|
|
|
}, |
|
5339
|
|
|
click: { |
|
5340
|
|
|
|
|
5341
|
|
|
// For checkbox, fire native event so checked state will be right |
|
5342
|
|
|
trigger: function() { |
|
5343
|
|
|
if ( this.type === "checkbox" && this.click && jQuery.nodeName( this, "input" ) ) { |
|
5344
|
|
|
this.click(); |
|
5345
|
|
|
return false; |
|
5346
|
|
|
} |
|
5347
|
|
|
}, |
|
5348
|
|
|
|
|
5349
|
|
|
// For cross-browser consistency, don't fire native .click() on links |
|
5350
|
|
|
_default: function( event ) { |
|
5351
|
|
|
return jQuery.nodeName( event.target, "a" ); |
|
5352
|
|
|
} |
|
5353
|
|
|
}, |
|
5354
|
|
|
|
|
5355
|
|
|
beforeunload: { |
|
5356
|
|
|
postDispatch: function( event ) { |
|
5357
|
|
|
|
|
5358
|
|
|
// Support: Firefox 20+ |
|
5359
|
|
|
// Firefox doesn't alert if the returnValue field is not set. |
|
5360
|
|
|
if ( event.result !== undefined && event.originalEvent ) { |
|
5361
|
|
|
event.originalEvent.returnValue = event.result; |
|
5362
|
|
|
} |
|
5363
|
|
|
} |
|
5364
|
|
|
} |
|
5365
|
|
|
} |
|
5366
|
|
|
}; |
|
5367
|
|
|
|
|
5368
|
|
|
jQuery.removeEvent = function( elem, type, handle ) { |
|
5369
|
|
|
|
|
5370
|
|
|
// This "if" is needed for plain objects |
|
5371
|
|
|
if ( elem.removeEventListener ) { |
|
5372
|
|
|
elem.removeEventListener( type, handle ); |
|
5373
|
|
|
} |
|
5374
|
|
|
}; |
|
5375
|
|
|
|
|
5376
|
|
|
jQuery.Event = function( src, props ) { |
|
5377
|
|
|
|
|
5378
|
|
|
// Allow instantiation without the 'new' keyword |
|
5379
|
|
|
if ( !( this instanceof jQuery.Event ) ) { |
|
5380
|
|
|
return new jQuery.Event( src, props ); |
|
5381
|
|
|
} |
|
5382
|
|
|
|
|
5383
|
|
|
// Event object |
|
5384
|
|
|
if ( src && src.type ) { |
|
5385
|
|
|
this.originalEvent = src; |
|
5386
|
|
|
this.type = src.type; |
|
5387
|
|
|
|
|
5388
|
|
|
// Events bubbling up the document may have been marked as prevented |
|
5389
|
|
|
// by a handler lower down the tree; reflect the correct value. |
|
5390
|
|
|
this.isDefaultPrevented = src.defaultPrevented || |
|
5391
|
|
|
src.defaultPrevented === undefined && |
|
5392
|
|
|
|
|
5393
|
|
|
// Support: Android <=2.3 only |
|
5394
|
|
|
src.returnValue === false ? |
|
5395
|
|
|
returnTrue : |
|
5396
|
|
|
returnFalse; |
|
5397
|
|
|
|
|
5398
|
|
|
// Create target properties |
|
5399
|
|
|
// Support: Safari <=6 - 7 only |
|
5400
|
|
|
// Target should not be a text node (#504, #13143) |
|
5401
|
|
|
this.target = ( src.target && src.target.nodeType === 3 ) ? |
|
5402
|
|
|
src.target.parentNode : |
|
5403
|
|
|
src.target; |
|
5404
|
|
|
|
|
5405
|
|
|
this.currentTarget = src.currentTarget; |
|
5406
|
|
|
this.relatedTarget = src.relatedTarget; |
|
5407
|
|
|
|
|
5408
|
|
|
// Event type |
|
5409
|
|
|
} else { |
|
5410
|
|
|
this.type = src; |
|
5411
|
|
|
} |
|
5412
|
|
|
|
|
5413
|
|
|
// Put explicitly provided properties onto the event object |
|
5414
|
|
|
if ( props ) { |
|
5415
|
|
|
jQuery.extend( this, props ); |
|
5416
|
|
|
} |
|
5417
|
|
|
|
|
5418
|
|
|
// Create a timestamp if incoming event doesn't have one |
|
5419
|
|
|
this.timeStamp = src && src.timeStamp || jQuery.now(); |
|
5420
|
|
|
|
|
5421
|
|
|
// Mark it as fixed |
|
5422
|
|
|
this[ jQuery.expando ] = true; |
|
5423
|
|
|
}; |
|
5424
|
|
|
|
|
5425
|
|
|
// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding |
|
5426
|
|
|
// https://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html |
|
5427
|
|
|
jQuery.Event.prototype = { |
|
5428
|
|
|
constructor: jQuery.Event, |
|
5429
|
|
|
isDefaultPrevented: returnFalse, |
|
5430
|
|
|
isPropagationStopped: returnFalse, |
|
5431
|
|
|
isImmediatePropagationStopped: returnFalse, |
|
5432
|
|
|
isSimulated: false, |
|
5433
|
|
|
|
|
5434
|
|
|
preventDefault: function() { |
|
5435
|
|
|
var e = this.originalEvent; |
|
5436
|
|
|
|
|
5437
|
|
|
this.isDefaultPrevented = returnTrue; |
|
5438
|
|
|
|
|
5439
|
|
|
if ( e && !this.isSimulated ) { |
|
5440
|
|
|
e.preventDefault(); |
|
5441
|
|
|
} |
|
5442
|
|
|
}, |
|
5443
|
|
|
stopPropagation: function() { |
|
5444
|
|
|
var e = this.originalEvent; |
|
5445
|
|
|
|
|
5446
|
|
|
this.isPropagationStopped = returnTrue; |
|
5447
|
|
|
|
|
5448
|
|
|
if ( e && !this.isSimulated ) { |
|
5449
|
|
|
e.stopPropagation(); |
|
5450
|
|
|
} |
|
5451
|
|
|
}, |
|
5452
|
|
|
stopImmediatePropagation: function() { |
|
5453
|
|
|
var e = this.originalEvent; |
|
5454
|
|
|
|
|
5455
|
|
|
this.isImmediatePropagationStopped = returnTrue; |
|
5456
|
|
|
|
|
5457
|
|
|
if ( e && !this.isSimulated ) { |
|
5458
|
|
|
e.stopImmediatePropagation(); |
|
5459
|
|
|
} |
|
5460
|
|
|
|
|
5461
|
|
|
this.stopPropagation(); |
|
5462
|
|
|
} |
|
5463
|
|
|
}; |
|
5464
|
|
|
|
|
5465
|
|
|
// Includes all common event props including KeyEvent and MouseEvent specific props |
|
5466
|
|
|
jQuery.each( { |
|
5467
|
|
|
altKey: true, |
|
5468
|
|
|
bubbles: true, |
|
5469
|
|
|
cancelable: true, |
|
5470
|
|
|
changedTouches: true, |
|
5471
|
|
|
ctrlKey: true, |
|
5472
|
|
|
detail: true, |
|
5473
|
|
|
eventPhase: true, |
|
5474
|
|
|
metaKey: true, |
|
5475
|
|
|
pageX: true, |
|
5476
|
|
|
pageY: true, |
|
5477
|
|
|
shiftKey: true, |
|
5478
|
|
|
view: true, |
|
5479
|
|
|
"char": true, |
|
5480
|
|
|
charCode: true, |
|
5481
|
|
|
key: true, |
|
5482
|
|
|
keyCode: true, |
|
5483
|
|
|
button: true, |
|
5484
|
|
|
buttons: true, |
|
5485
|
|
|
clientX: true, |
|
5486
|
|
|
clientY: true, |
|
5487
|
|
|
offsetX: true, |
|
5488
|
|
|
offsetY: true, |
|
5489
|
|
|
pointerId: true, |
|
5490
|
|
|
pointerType: true, |
|
5491
|
|
|
screenX: true, |
|
5492
|
|
|
screenY: true, |
|
5493
|
|
|
targetTouches: true, |
|
5494
|
|
|
toElement: true, |
|
5495
|
|
|
touches: true, |
|
5496
|
|
|
|
|
5497
|
|
|
which: function( event ) { |
|
5498
|
|
|
var button = event.button; |
|
5499
|
|
|
|
|
5500
|
|
|
// Add which for key events |
|
5501
|
|
|
if ( event.which == null && rkeyEvent.test( event.type ) ) { |
|
5502
|
|
|
return event.charCode != null ? event.charCode : event.keyCode; |
|
5503
|
|
|
} |
|
5504
|
|
|
|
|
5505
|
|
|
// Add which for click: 1 === left; 2 === middle; 3 === right |
|
5506
|
|
|
if ( !event.which && button !== undefined && rmouseEvent.test( event.type ) ) { |
|
5507
|
|
|
if ( button & 1 ) { |
|
5508
|
|
|
return 1; |
|
5509
|
|
|
} |
|
5510
|
|
|
|
|
5511
|
|
|
if ( button & 2 ) { |
|
5512
|
|
|
return 3; |
|
5513
|
|
|
} |
|
5514
|
|
|
|
|
5515
|
|
|
if ( button & 4 ) { |
|
5516
|
|
|
return 2; |
|
5517
|
|
|
} |
|
5518
|
|
|
|
|
5519
|
|
|
return 0; |
|
5520
|
|
|
} |
|
5521
|
|
|
|
|
5522
|
|
|
return event.which; |
|
5523
|
|
|
} |
|
5524
|
|
|
}, jQuery.event.addProp ); |
|
5525
|
|
|
|
|
5526
|
|
|
// Create mouseenter/leave events using mouseover/out and event-time checks |
|
5527
|
|
|
// so that event delegation works in jQuery. |
|
5528
|
|
|
// Do the same for pointerenter/pointerleave and pointerover/pointerout |
|
5529
|
|
|
// |
|
5530
|
|
|
// Support: Safari 7 only |
|
5531
|
|
|
// Safari sends mouseenter too often; see: |
|
5532
|
|
|
// https://bugs.chromium.org/p/chromium/issues/detail?id=470258 |
|
5533
|
|
|
// for the description of the bug (it existed in older Chrome versions as well). |
|
5534
|
|
|
jQuery.each( { |
|
5535
|
|
|
mouseenter: "mouseover", |
|
5536
|
|
|
mouseleave: "mouseout", |
|
5537
|
|
|
pointerenter: "pointerover", |
|
5538
|
|
|
pointerleave: "pointerout" |
|
5539
|
|
|
}, function( orig, fix ) { |
|
5540
|
|
|
jQuery.event.special[ orig ] = { |
|
5541
|
|
|
delegateType: fix, |
|
5542
|
|
|
bindType: fix, |
|
5543
|
|
|
|
|
5544
|
|
|
handle: function( event ) { |
|
5545
|
|
|
var ret, |
|
5546
|
|
|
target = this, |
|
5547
|
|
|
related = event.relatedTarget, |
|
5548
|
|
|
handleObj = event.handleObj; |
|
5549
|
|
|
|
|
5550
|
|
|
// For mouseenter/leave call the handler if related is outside the target. |
|
5551
|
|
|
// NB: No relatedTarget if the mouse left/entered the browser window |
|
5552
|
|
|
if ( !related || ( related !== target && !jQuery.contains( target, related ) ) ) { |
|
5553
|
|
|
event.type = handleObj.origType; |
|
5554
|
|
|
ret = handleObj.handler.apply( this, arguments ); |
|
5555
|
|
|
event.type = fix; |
|
5556
|
|
|
} |
|
5557
|
|
|
return ret; |
|
5558
|
|
|
} |
|
5559
|
|
|
}; |
|
5560
|
|
|
} ); |
|
5561
|
|
|
|
|
5562
|
|
|
jQuery.fn.extend( { |
|
5563
|
|
|
|
|
5564
|
|
|
on: function( types, selector, data, fn ) { |
|
5565
|
|
|
return on( this, types, selector, data, fn ); |
|
5566
|
|
|
}, |
|
5567
|
|
|
one: function( types, selector, data, fn ) { |
|
5568
|
|
|
return on( this, types, selector, data, fn, 1 ); |
|
5569
|
|
|
}, |
|
5570
|
|
|
off: function( types, selector, fn ) { |
|
5571
|
|
|
var handleObj, type; |
|
5572
|
|
|
if ( types && types.preventDefault && types.handleObj ) { |
|
5573
|
|
|
|
|
5574
|
|
|
// ( event ) dispatched jQuery.Event |
|
5575
|
|
|
handleObj = types.handleObj; |
|
5576
|
|
|
jQuery( types.delegateTarget ).off( |
|
5577
|
|
|
handleObj.namespace ? |
|
5578
|
|
|
handleObj.origType + "." + handleObj.namespace : |
|
5579
|
|
|
handleObj.origType, |
|
5580
|
|
|
handleObj.selector, |
|
5581
|
|
|
handleObj.handler |
|
5582
|
|
|
); |
|
5583
|
|
|
return this; |
|
5584
|
|
|
} |
|
5585
|
|
|
if ( typeof types === "object" ) { |
|
5586
|
|
|
|
|
5587
|
|
|
// ( types-object [, selector] ) |
|
5588
|
|
|
for ( type in types ) { |
|
5589
|
|
|
this.off( type, selector, types[ type ] ); |
|
5590
|
|
|
} |
|
5591
|
|
|
return this; |
|
5592
|
|
|
} |
|
5593
|
|
|
if ( selector === false || typeof selector === "function" ) { |
|
5594
|
|
|
|
|
5595
|
|
|
// ( types [, fn] ) |
|
5596
|
|
|
fn = selector; |
|
5597
|
|
|
selector = undefined; |
|
5598
|
|
|
} |
|
5599
|
|
|
if ( fn === false ) { |
|
5600
|
|
|
fn = returnFalse; |
|
5601
|
|
|
} |
|
5602
|
|
|
return this.each( function() { |
|
5603
|
|
|
jQuery.event.remove( this, types, fn, selector ); |
|
5604
|
|
|
} ); |
|
5605
|
|
|
} |
|
5606
|
|
|
} ); |
|
5607
|
|
|
|
|
5608
|
|
|
|
|
5609
|
|
|
var |
|
5610
|
|
|
|
|
5611
|
|
|
/* eslint-disable max-len */ |
|
5612
|
|
|
|
|
5613
|
|
|
// See https://github.com/eslint/eslint/issues/3229 |
|
5614
|
|
|
rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([a-z][^\/\0>\x20\t\r\n\f]*)[^>]*)\/>/gi, |
|
5615
|
|
|
|
|
5616
|
|
|
/* eslint-enable */ |
|
5617
|
|
|
|
|
5618
|
|
|
// Support: IE <=10 - 11, Edge 12 - 13 |
|
5619
|
|
|
// In IE/Edge using regex groups here causes severe slowdowns. |
|
5620
|
|
|
// See https://connect.microsoft.com/IE/feedback/details/1736512/ |
|
5621
|
|
|
rnoInnerhtml = /<script|<style|<link/i, |
|
5622
|
|
|
|
|
5623
|
|
|
// checked="checked" or checked |
|
5624
|
|
|
rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i, |
|
5625
|
|
|
rscriptTypeMasked = /^true\/(.*)/, |
|
5626
|
|
|
rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g; |
|
5627
|
|
|
|
|
5628
|
|
|
function manipulationTarget( elem, content ) { |
|
5629
|
|
|
if ( jQuery.nodeName( elem, "table" ) && |
|
5630
|
|
|
jQuery.nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ) { |
|
5631
|
|
|
|
|
5632
|
|
|
return elem.getElementsByTagName( "tbody" )[ 0 ] || elem; |
|
5633
|
|
|
} |
|
5634
|
|
|
|
|
5635
|
|
|
return elem; |
|
5636
|
|
|
} |
|
5637
|
|
|
|
|
5638
|
|
|
// Replace/restore the type attribute of script elements for safe DOM manipulation |
|
5639
|
|
|
function disableScript( elem ) { |
|
5640
|
|
|
elem.type = ( elem.getAttribute( "type" ) !== null ) + "/" + elem.type; |
|
5641
|
|
|
return elem; |
|
5642
|
|
|
} |
|
5643
|
|
|
function restoreScript( elem ) { |
|
5644
|
|
|
var match = rscriptTypeMasked.exec( elem.type ); |
|
5645
|
|
|
|
|
5646
|
|
|
if ( match ) { |
|
5647
|
|
|
elem.type = match[ 1 ]; |
|
5648
|
|
|
} else { |
|
5649
|
|
|
elem.removeAttribute( "type" ); |
|
5650
|
|
|
} |
|
5651
|
|
|
|
|
5652
|
|
|
return elem; |
|
5653
|
|
|
} |
|
5654
|
|
|
|
|
5655
|
|
|
function cloneCopyEvent( src, dest ) { |
|
5656
|
|
|
var i, l, type, pdataOld, pdataCur, udataOld, udataCur, events; |
|
5657
|
|
|
|
|
5658
|
|
|
if ( dest.nodeType !== 1 ) { |
|
5659
|
|
|
return; |
|
5660
|
|
|
} |
|
5661
|
|
|
|
|
5662
|
|
|
// 1. Copy private data: events, handlers, etc. |
|
5663
|
|
|
if ( dataPriv.hasData( src ) ) { |
|
5664
|
|
|
pdataOld = dataPriv.access( src ); |
|
5665
|
|
|
pdataCur = dataPriv.set( dest, pdataOld ); |
|
5666
|
|
|
events = pdataOld.events; |
|
5667
|
|
|
|
|
5668
|
|
|
if ( events ) { |
|
5669
|
|
|
delete pdataCur.handle; |
|
5670
|
|
|
pdataCur.events = {}; |
|
5671
|
|
|
|
|
5672
|
|
|
for ( type in events ) { |
|
5673
|
|
|
for ( i = 0, l = events[ type ].length; i < l; i++ ) { |
|
5674
|
|
|
jQuery.event.add( dest, type, events[ type ][ i ] ); |
|
5675
|
|
|
} |
|
5676
|
|
|
} |
|
5677
|
|
|
} |
|
5678
|
|
|
} |
|
5679
|
|
|
|
|
5680
|
|
|
// 2. Copy user data |
|
5681
|
|
|
if ( dataUser.hasData( src ) ) { |
|
5682
|
|
|
udataOld = dataUser.access( src ); |
|
5683
|
|
|
udataCur = jQuery.extend( {}, udataOld ); |
|
5684
|
|
|
|
|
5685
|
|
|
dataUser.set( dest, udataCur ); |
|
5686
|
|
|
} |
|
5687
|
|
|
} |
|
5688
|
|
|
|
|
5689
|
|
|
// Fix IE bugs, see support tests |
|
5690
|
|
|
function fixInput( src, dest ) { |
|
5691
|
|
|
var nodeName = dest.nodeName.toLowerCase(); |
|
5692
|
|
|
|
|
5693
|
|
|
// Fails to persist the checked state of a cloned checkbox or radio button. |
|
5694
|
|
|
if ( nodeName === "input" && rcheckableType.test( src.type ) ) { |
|
5695
|
|
|
dest.checked = src.checked; |
|
5696
|
|
|
|
|
5697
|
|
|
// Fails to return the selected option to the default selected state when cloning options |
|
5698
|
|
|
} else if ( nodeName === "input" || nodeName === "textarea" ) { |
|
5699
|
|
|
dest.defaultValue = src.defaultValue; |
|
5700
|
|
|
} |
|
5701
|
|
|
} |
|
5702
|
|
|
|
|
5703
|
|
|
function domManip( collection, args, callback, ignored ) { |
|
5704
|
|
|
|
|
5705
|
|
|
// Flatten any nested arrays |
|
5706
|
|
|
args = concat.apply( [], args ); |
|
5707
|
|
|
|
|
5708
|
|
|
var fragment, first, scripts, hasScripts, node, doc, |
|
5709
|
|
|
i = 0, |
|
5710
|
|
|
l = collection.length, |
|
5711
|
|
|
iNoClone = l - 1, |
|
5712
|
|
|
value = args[ 0 ], |
|
5713
|
|
|
isFunction = jQuery.isFunction( value ); |
|
5714
|
|
|
|
|
5715
|
|
|
// We can't cloneNode fragments that contain checked, in WebKit |
|
5716
|
|
|
if ( isFunction || |
|
5717
|
|
|
( l > 1 && typeof value === "string" && |
|
5718
|
|
|
!support.checkClone && rchecked.test( value ) ) ) { |
|
5719
|
|
|
return collection.each( function( index ) { |
|
5720
|
|
|
var self = collection.eq( index ); |
|
5721
|
|
|
if ( isFunction ) { |
|
5722
|
|
|
args[ 0 ] = value.call( this, index, self.html() ); |
|
5723
|
|
|
} |
|
5724
|
|
|
domManip( self, args, callback, ignored ); |
|
5725
|
|
|
} ); |
|
5726
|
|
|
} |
|
5727
|
|
|
|
|
5728
|
|
|
if ( l ) { |
|
5729
|
|
|
fragment = buildFragment( args, collection[ 0 ].ownerDocument, false, collection, ignored ); |
|
5730
|
|
|
first = fragment.firstChild; |
|
5731
|
|
|
|
|
5732
|
|
|
if ( fragment.childNodes.length === 1 ) { |
|
5733
|
|
|
fragment = first; |
|
5734
|
|
|
} |
|
5735
|
|
|
|
|
5736
|
|
|
// Require either new content or an interest in ignored elements to invoke the callback |
|
5737
|
|
|
if ( first || ignored ) { |
|
5738
|
|
|
scripts = jQuery.map( getAll( fragment, "script" ), disableScript ); |
|
5739
|
|
|
hasScripts = scripts.length; |
|
5740
|
|
|
|
|
5741
|
|
|
// Use the original fragment for the last item |
|
5742
|
|
|
// instead of the first because it can end up |
|
5743
|
|
|
// being emptied incorrectly in certain situations (#8070). |
|
5744
|
|
|
for ( ; i < l; i++ ) { |
|
5745
|
|
|
node = fragment; |
|
5746
|
|
|
|
|
5747
|
|
|
if ( i !== iNoClone ) { |
|
5748
|
|
|
node = jQuery.clone( node, true, true ); |
|
5749
|
|
|
|
|
5750
|
|
|
// Keep references to cloned scripts for later restoration |
|
5751
|
|
|
if ( hasScripts ) { |
|
5752
|
|
|
|
|
5753
|
|
|
// Support: Android <=4.0 only, PhantomJS 1 only |
|
5754
|
|
|
// push.apply(_, arraylike) throws on ancient WebKit |
|
5755
|
|
|
jQuery.merge( scripts, getAll( node, "script" ) ); |
|
5756
|
|
|
} |
|
5757
|
|
|
} |
|
5758
|
|
|
|
|
5759
|
|
|
callback.call( collection[ i ], node, i ); |
|
5760
|
|
|
} |
|
5761
|
|
|
|
|
5762
|
|
|
if ( hasScripts ) { |
|
5763
|
|
|
doc = scripts[ scripts.length - 1 ].ownerDocument; |
|
5764
|
|
|
|
|
5765
|
|
|
// Reenable scripts |
|
5766
|
|
|
jQuery.map( scripts, restoreScript ); |
|
5767
|
|
|
|
|
5768
|
|
|
// Evaluate executable scripts on first document insertion |
|
5769
|
|
|
for ( i = 0; i < hasScripts; i++ ) { |
|
5770
|
|
|
node = scripts[ i ]; |
|
5771
|
|
|
if ( rscriptType.test( node.type || "" ) && |
|
5772
|
|
|
!dataPriv.access( node, "globalEval" ) && |
|
5773
|
|
|
jQuery.contains( doc, node ) ) { |
|
5774
|
|
|
|
|
5775
|
|
|
if ( node.src ) { |
|
5776
|
|
|
|
|
5777
|
|
|
// Optional AJAX dependency, but won't run scripts if not present |
|
5778
|
|
|
if ( jQuery._evalUrl ) { |
|
5779
|
|
|
jQuery._evalUrl( node.src ); |
|
5780
|
|
|
} |
|
5781
|
|
|
} else { |
|
5782
|
|
|
DOMEval( node.textContent.replace( rcleanScript, "" ), doc ); |
|
5783
|
|
|
} |
|
5784
|
|
|
} |
|
5785
|
|
|
} |
|
5786
|
|
|
} |
|
5787
|
|
|
} |
|
5788
|
|
|
} |
|
5789
|
|
|
|
|
5790
|
|
|
return collection; |
|
5791
|
|
|
} |
|
5792
|
|
|
|
|
5793
|
|
|
function remove( elem, selector, keepData ) { |
|
5794
|
|
|
var node, |
|
5795
|
|
|
nodes = selector ? jQuery.filter( selector, elem ) : elem, |
|
5796
|
|
|
i = 0; |
|
5797
|
|
|
|
|
5798
|
|
|
for ( ; ( node = nodes[ i ] ) != null; i++ ) { |
|
5799
|
|
|
if ( !keepData && node.nodeType === 1 ) { |
|
5800
|
|
|
jQuery.cleanData( getAll( node ) ); |
|
5801
|
|
|
} |
|
5802
|
|
|
|
|
5803
|
|
|
if ( node.parentNode ) { |
|
5804
|
|
|
if ( keepData && jQuery.contains( node.ownerDocument, node ) ) { |
|
5805
|
|
|
setGlobalEval( getAll( node, "script" ) ); |
|
5806
|
|
|
} |
|
5807
|
|
|
node.parentNode.removeChild( node ); |
|
5808
|
|
|
} |
|
5809
|
|
|
} |
|
5810
|
|
|
|
|
5811
|
|
|
return elem; |
|
5812
|
|
|
} |
|
5813
|
|
|
|
|
5814
|
|
|
jQuery.extend( { |
|
5815
|
|
|
htmlPrefilter: function( html ) { |
|
5816
|
|
|
return html.replace( rxhtmlTag, "<$1></$2>" ); |
|
5817
|
|
|
}, |
|
5818
|
|
|
|
|
5819
|
|
|
clone: function( elem, dataAndEvents, deepDataAndEvents ) { |
|
5820
|
|
|
var i, l, srcElements, destElements, |
|
5821
|
|
|
clone = elem.cloneNode( true ), |
|
5822
|
|
|
inPage = jQuery.contains( elem.ownerDocument, elem ); |
|
5823
|
|
|
|
|
5824
|
|
|
// Fix IE cloning issues |
|
5825
|
|
|
if ( !support.noCloneChecked && ( elem.nodeType === 1 || elem.nodeType === 11 ) && |
|
5826
|
|
|
!jQuery.isXMLDoc( elem ) ) { |
|
5827
|
|
|
|
|
5828
|
|
|
// We eschew Sizzle here for performance reasons: https://jsperf.com/getall-vs-sizzle/2 |
|
5829
|
|
|
destElements = getAll( clone ); |
|
5830
|
|
|
srcElements = getAll( elem ); |
|
5831
|
|
|
|
|
5832
|
|
|
for ( i = 0, l = srcElements.length; i < l; i++ ) { |
|
5833
|
|
|
fixInput( srcElements[ i ], destElements[ i ] ); |
|
5834
|
|
|
} |
|
5835
|
|
|
} |
|
5836
|
|
|
|
|
5837
|
|
|
// Copy the events from the original to the clone |
|
5838
|
|
|
if ( dataAndEvents ) { |
|
5839
|
|
|
if ( deepDataAndEvents ) { |
|
5840
|
|
|
srcElements = srcElements || getAll( elem ); |
|
5841
|
|
|
destElements = destElements || getAll( clone ); |
|
5842
|
|
|
|
|
5843
|
|
|
for ( i = 0, l = srcElements.length; i < l; i++ ) { |
|
5844
|
|
|
cloneCopyEvent( srcElements[ i ], destElements[ i ] ); |
|
5845
|
|
|
} |
|
5846
|
|
|
} else { |
|
5847
|
|
|
cloneCopyEvent( elem, clone ); |
|
5848
|
|
|
} |
|
5849
|
|
|
} |
|
5850
|
|
|
|
|
5851
|
|
|
// Preserve script evaluation history |
|
5852
|
|
|
destElements = getAll( clone, "script" ); |
|
5853
|
|
|
if ( destElements.length > 0 ) { |
|
5854
|
|
|
setGlobalEval( destElements, !inPage && getAll( elem, "script" ) ); |
|
5855
|
|
|
} |
|
5856
|
|
|
|
|
5857
|
|
|
// Return the cloned set |
|
5858
|
|
|
return clone; |
|
5859
|
|
|
}, |
|
5860
|
|
|
|
|
5861
|
|
|
cleanData: function( elems ) { |
|
5862
|
|
|
var data, elem, type, |
|
5863
|
|
|
special = jQuery.event.special, |
|
5864
|
|
|
i = 0; |
|
5865
|
|
|
|
|
5866
|
|
|
for ( ; ( elem = elems[ i ] ) !== undefined; i++ ) { |
|
5867
|
|
|
if ( acceptData( elem ) ) { |
|
5868
|
|
|
if ( ( data = elem[ dataPriv.expando ] ) ) { |
|
5869
|
|
|
if ( data.events ) { |
|
5870
|
|
|
for ( type in data.events ) { |
|
5871
|
|
|
if ( special[ type ] ) { |
|
5872
|
|
|
jQuery.event.remove( elem, type ); |
|
5873
|
|
|
|
|
5874
|
|
|
// This is a shortcut to avoid jQuery.event.remove's overhead |
|
5875
|
|
|
} else { |
|
5876
|
|
|
jQuery.removeEvent( elem, type, data.handle ); |
|
5877
|
|
|
} |
|
5878
|
|
|
} |
|
5879
|
|
|
} |
|
5880
|
|
|
|
|
5881
|
|
|
// Support: Chrome <=35 - 45+ |
|
5882
|
|
|
// Assign undefined instead of using delete, see Data#remove |
|
5883
|
|
|
elem[ dataPriv.expando ] = undefined; |
|
5884
|
|
|
} |
|
5885
|
|
|
if ( elem[ dataUser.expando ] ) { |
|
5886
|
|
|
|
|
5887
|
|
|
// Support: Chrome <=35 - 45+ |
|
5888
|
|
|
// Assign undefined instead of using delete, see Data#remove |
|
5889
|
|
|
elem[ dataUser.expando ] = undefined; |
|
5890
|
|
|
} |
|
5891
|
|
|
} |
|
5892
|
|
|
} |
|
5893
|
|
|
} |
|
5894
|
|
|
} ); |
|
5895
|
|
|
|
|
5896
|
|
|
jQuery.fn.extend( { |
|
5897
|
|
|
detach: function( selector ) { |
|
5898
|
|
|
return remove( this, selector, true ); |
|
5899
|
|
|
}, |
|
5900
|
|
|
|
|
5901
|
|
|
remove: function( selector ) { |
|
5902
|
|
|
return remove( this, selector ); |
|
5903
|
|
|
}, |
|
5904
|
|
|
|
|
5905
|
|
|
text: function( value ) { |
|
5906
|
|
|
return access( this, function( value ) { |
|
5907
|
|
|
return value === undefined ? |
|
5908
|
|
|
jQuery.text( this ) : |
|
5909
|
|
|
this.empty().each( function() { |
|
5910
|
|
|
if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { |
|
5911
|
|
|
this.textContent = value; |
|
5912
|
|
|
} |
|
5913
|
|
|
} ); |
|
5914
|
|
|
}, null, value, arguments.length ); |
|
5915
|
|
|
}, |
|
5916
|
|
|
|
|
5917
|
|
|
append: function() { |
|
5918
|
|
|
return domManip( this, arguments, function( elem ) { |
|
5919
|
|
|
if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { |
|
5920
|
|
|
var target = manipulationTarget( this, elem ); |
|
5921
|
|
|
target.appendChild( elem ); |
|
5922
|
|
|
} |
|
5923
|
|
|
} ); |
|
5924
|
|
|
}, |
|
5925
|
|
|
|
|
5926
|
|
|
prepend: function() { |
|
5927
|
|
|
return domManip( this, arguments, function( elem ) { |
|
5928
|
|
|
if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { |
|
5929
|
|
|
var target = manipulationTarget( this, elem ); |
|
5930
|
|
|
target.insertBefore( elem, target.firstChild ); |
|
5931
|
|
|
} |
|
5932
|
|
|
} ); |
|
5933
|
|
|
}, |
|
5934
|
|
|
|
|
5935
|
|
|
before: function() { |
|
5936
|
|
|
return domManip( this, arguments, function( elem ) { |
|
5937
|
|
|
if ( this.parentNode ) { |
|
5938
|
|
|
this.parentNode.insertBefore( elem, this ); |
|
5939
|
|
|
} |
|
5940
|
|
|
} ); |
|
5941
|
|
|
}, |
|
5942
|
|
|
|
|
5943
|
|
|
after: function() { |
|
5944
|
|
|
return domManip( this, arguments, function( elem ) { |
|
5945
|
|
|
if ( this.parentNode ) { |
|
5946
|
|
|
this.parentNode.insertBefore( elem, this.nextSibling ); |
|
5947
|
|
|
} |
|
5948
|
|
|
} ); |
|
5949
|
|
|
}, |
|
5950
|
|
|
|
|
5951
|
|
|
empty: function() { |
|
5952
|
|
|
var elem, |
|
5953
|
|
|
i = 0; |
|
5954
|
|
|
|
|
5955
|
|
|
for ( ; ( elem = this[ i ] ) != null; i++ ) { |
|
5956
|
|
|
if ( elem.nodeType === 1 ) { |
|
5957
|
|
|
|
|
5958
|
|
|
// Prevent memory leaks |
|
5959
|
|
|
jQuery.cleanData( getAll( elem, false ) ); |
|
5960
|
|
|
|
|
5961
|
|
|
// Remove any remaining nodes |
|
5962
|
|
|
elem.textContent = ""; |
|
5963
|
|
|
} |
|
5964
|
|
|
} |
|
5965
|
|
|
|
|
5966
|
|
|
return this; |
|
5967
|
|
|
}, |
|
5968
|
|
|
|
|
5969
|
|
|
clone: function( dataAndEvents, deepDataAndEvents ) { |
|
5970
|
|
|
dataAndEvents = dataAndEvents == null ? false : dataAndEvents; |
|
5971
|
|
|
deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents; |
|
5972
|
|
|
|
|
5973
|
|
|
return this.map( function() { |
|
5974
|
|
|
return jQuery.clone( this, dataAndEvents, deepDataAndEvents ); |
|
5975
|
|
|
} ); |
|
5976
|
|
|
}, |
|
5977
|
|
|
|
|
5978
|
|
|
html: function( value ) { |
|
5979
|
|
|
return access( this, function( value ) { |
|
5980
|
|
|
var elem = this[ 0 ] || {}, |
|
5981
|
|
|
i = 0, |
|
5982
|
|
|
l = this.length; |
|
5983
|
|
|
|
|
5984
|
|
|
if ( value === undefined && elem.nodeType === 1 ) { |
|
5985
|
|
|
return elem.innerHTML; |
|
5986
|
|
|
} |
|
5987
|
|
|
|
|
5988
|
|
|
// See if we can take a shortcut and just use innerHTML |
|
5989
|
|
|
if ( typeof value === "string" && !rnoInnerhtml.test( value ) && |
|
5990
|
|
|
!wrapMap[ ( rtagName.exec( value ) || [ "", "" ] )[ 1 ].toLowerCase() ] ) { |
|
5991
|
|
|
|
|
5992
|
|
|
value = jQuery.htmlPrefilter( value ); |
|
5993
|
|
|
|
|
5994
|
|
|
try { |
|
5995
|
|
|
for ( ; i < l; i++ ) { |
|
5996
|
|
|
elem = this[ i ] || {}; |
|
5997
|
|
|
|
|
5998
|
|
|
// Remove element nodes and prevent memory leaks |
|
5999
|
|
|
if ( elem.nodeType === 1 ) { |
|
6000
|
|
|
jQuery.cleanData( getAll( elem, false ) ); |
|
6001
|
|
|
elem.innerHTML = value; |
|
6002
|
|
|
} |
|
6003
|
|
|
} |
|
6004
|
|
|
|
|
6005
|
|
|
elem = 0; |
|
6006
|
|
|
|
|
6007
|
|
|
// If using innerHTML throws an exception, use the fallback method |
|
6008
|
|
|
} catch ( e ) {} |
|
6009
|
|
|
} |
|
6010
|
|
|
|
|
6011
|
|
|
if ( elem ) { |
|
6012
|
|
|
this.empty().append( value ); |
|
6013
|
|
|
} |
|
6014
|
|
|
}, null, value, arguments.length ); |
|
6015
|
|
|
}, |
|
6016
|
|
|
|
|
6017
|
|
|
replaceWith: function() { |
|
6018
|
|
|
var ignored = []; |
|
6019
|
|
|
|
|
6020
|
|
|
// Make the changes, replacing each non-ignored context element with the new content |
|
6021
|
|
|
return domManip( this, arguments, function( elem ) { |
|
6022
|
|
|
var parent = this.parentNode; |
|
6023
|
|
|
|
|
6024
|
|
|
if ( jQuery.inArray( this, ignored ) < 0 ) { |
|
6025
|
|
|
jQuery.cleanData( getAll( this ) ); |
|
6026
|
|
|
if ( parent ) { |
|
6027
|
|
|
parent.replaceChild( elem, this ); |
|
6028
|
|
|
} |
|
6029
|
|
|
} |
|
6030
|
|
|
|
|
6031
|
|
|
// Force callback invocation |
|
6032
|
|
|
}, ignored ); |
|
6033
|
|
|
} |
|
6034
|
|
|
} ); |
|
6035
|
|
|
|
|
6036
|
|
|
jQuery.each( { |
|
6037
|
|
|
appendTo: "append", |
|
6038
|
|
|
prependTo: "prepend", |
|
6039
|
|
|
insertBefore: "before", |
|
6040
|
|
|
insertAfter: "after", |
|
6041
|
|
|
replaceAll: "replaceWith" |
|
6042
|
|
|
}, function( name, original ) { |
|
6043
|
|
|
jQuery.fn[ name ] = function( selector ) { |
|
6044
|
|
|
var elems, |
|
6045
|
|
|
ret = [], |
|
6046
|
|
|
insert = jQuery( selector ), |
|
6047
|
|
|
last = insert.length - 1, |
|
6048
|
|
|
i = 0; |
|
6049
|
|
|
|
|
6050
|
|
|
for ( ; i <= last; i++ ) { |
|
6051
|
|
|
elems = i === last ? this : this.clone( true ); |
|
6052
|
|
|
jQuery( insert[ i ] )[ original ]( elems ); |
|
6053
|
|
|
|
|
6054
|
|
|
// Support: Android <=4.0 only, PhantomJS 1 only |
|
6055
|
|
|
// .get() because push.apply(_, arraylike) throws on ancient WebKit |
|
6056
|
|
|
push.apply( ret, elems.get() ); |
|
6057
|
|
|
} |
|
6058
|
|
|
|
|
6059
|
|
|
return this.pushStack( ret ); |
|
6060
|
|
|
}; |
|
6061
|
|
|
} ); |
|
6062
|
|
|
var rmargin = ( /^margin/ ); |
|
6063
|
|
|
|
|
6064
|
|
|
var rnumnonpx = new RegExp( "^(" + pnum + ")(?!px)[a-z%]+$", "i" ); |
|
6065
|
|
|
|
|
6066
|
|
|
var getStyles = function( elem ) { |
|
6067
|
|
|
|
|
6068
|
|
|
// Support: IE <=11 only, Firefox <=30 (#15098, #14150) |
|
6069
|
|
|
// IE throws on elements created in popups |
|
6070
|
|
|
// FF meanwhile throws on frame elements through "defaultView.getComputedStyle" |
|
6071
|
|
|
var view = elem.ownerDocument.defaultView; |
|
6072
|
|
|
|
|
6073
|
|
|
if ( !view || !view.opener ) { |
|
6074
|
|
|
view = window; |
|
6075
|
|
|
} |
|
6076
|
|
|
|
|
6077
|
|
|
return view.getComputedStyle( elem ); |
|
6078
|
|
|
}; |
|
6079
|
|
|
|
|
6080
|
|
|
|
|
6081
|
|
|
|
|
6082
|
|
|
( function() { |
|
6083
|
|
|
|
|
6084
|
|
|
// Executing both pixelPosition & boxSizingReliable tests require only one layout |
|
6085
|
|
|
// so they're executed at the same time to save the second computation. |
|
6086
|
|
|
function computeStyleTests() { |
|
6087
|
|
|
|
|
6088
|
|
|
// This is a singleton, we need to execute it only once |
|
6089
|
|
|
if ( !div ) { |
|
6090
|
|
|
return; |
|
6091
|
|
|
} |
|
6092
|
|
|
|
|
6093
|
|
|
div.style.cssText = |
|
6094
|
|
|
"box-sizing:border-box;" + |
|
6095
|
|
|
"position:relative;display:block;" + |
|
6096
|
|
|
"margin:auto;border:1px;padding:1px;" + |
|
6097
|
|
|
"top:1%;width:50%"; |
|
6098
|
|
|
div.innerHTML = ""; |
|
6099
|
|
|
documentElement.appendChild( container ); |
|
6100
|
|
|
|
|
6101
|
|
|
var divStyle = window.getComputedStyle( div ); |
|
6102
|
|
|
pixelPositionVal = divStyle.top !== "1%"; |
|
6103
|
|
|
|
|
6104
|
|
|
// Support: Android 4.0 - 4.3 only, Firefox <=3 - 44 |
|
6105
|
|
|
reliableMarginLeftVal = divStyle.marginLeft === "2px"; |
|
6106
|
|
|
boxSizingReliableVal = divStyle.width === "4px"; |
|
6107
|
|
|
|
|
6108
|
|
|
// Support: Android 4.0 - 4.3 only |
|
6109
|
|
|
// Some styles come back with percentage values, even though they shouldn't |
|
6110
|
|
|
div.style.marginRight = "50%"; |
|
6111
|
|
|
pixelMarginRightVal = divStyle.marginRight === "4px"; |
|
6112
|
|
|
|
|
6113
|
|
|
documentElement.removeChild( container ); |
|
6114
|
|
|
|
|
6115
|
|
|
// Nullify the div so it wouldn't be stored in the memory and |
|
6116
|
|
|
// it will also be a sign that checks already performed |
|
6117
|
|
|
div = null; |
|
6118
|
|
|
} |
|
6119
|
|
|
|
|
6120
|
|
|
var pixelPositionVal, boxSizingReliableVal, pixelMarginRightVal, reliableMarginLeftVal, |
|
6121
|
|
|
container = document.createElement( "div" ), |
|
6122
|
|
|
div = document.createElement( "div" ); |
|
6123
|
|
|
|
|
6124
|
|
|
// Finish early in limited (non-browser) environments |
|
6125
|
|
|
if ( !div.style ) { |
|
6126
|
|
|
return; |
|
6127
|
|
|
} |
|
6128
|
|
|
|
|
6129
|
|
|
// Support: IE <=9 - 11 only |
|
6130
|
|
|
// Style of cloned element affects source element cloned (#8908) |
|
6131
|
|
|
div.style.backgroundClip = "content-box"; |
|
6132
|
|
|
div.cloneNode( true ).style.backgroundClip = ""; |
|
6133
|
|
|
support.clearCloneStyle = div.style.backgroundClip === "content-box"; |
|
6134
|
|
|
|
|
6135
|
|
|
container.style.cssText = "border:0;width:8px;height:0;top:0;left:-9999px;" + |
|
6136
|
|
|
"padding:0;margin-top:1px;position:absolute"; |
|
6137
|
|
|
container.appendChild( div ); |
|
6138
|
|
|
|
|
6139
|
|
|
jQuery.extend( support, { |
|
6140
|
|
|
pixelPosition: function() { |
|
6141
|
|
|
computeStyleTests(); |
|
6142
|
|
|
return pixelPositionVal; |
|
6143
|
|
|
}, |
|
6144
|
|
|
boxSizingReliable: function() { |
|
6145
|
|
|
computeStyleTests(); |
|
6146
|
|
|
return boxSizingReliableVal; |
|
6147
|
|
|
}, |
|
6148
|
|
|
pixelMarginRight: function() { |
|
6149
|
|
|
computeStyleTests(); |
|
6150
|
|
|
return pixelMarginRightVal; |
|
6151
|
|
|
}, |
|
6152
|
|
|
reliableMarginLeft: function() { |
|
6153
|
|
|
computeStyleTests(); |
|
6154
|
|
|
return reliableMarginLeftVal; |
|
6155
|
|
|
} |
|
6156
|
|
|
} ); |
|
6157
|
|
|
} )(); |
|
6158
|
|
|
|
|
6159
|
|
|
|
|
6160
|
|
|
function curCSS( elem, name, computed ) { |
|
6161
|
|
|
var width, minWidth, maxWidth, ret, |
|
6162
|
|
|
style = elem.style; |
|
6163
|
|
|
|
|
6164
|
|
|
computed = computed || getStyles( elem ); |
|
6165
|
|
|
|
|
6166
|
|
|
// Support: IE <=9 only |
|
6167
|
|
|
// getPropertyValue is only needed for .css('filter') (#12537) |
|
6168
|
|
|
if ( computed ) { |
|
6169
|
|
|
ret = computed.getPropertyValue( name ) || computed[ name ]; |
|
6170
|
|
|
|
|
6171
|
|
|
if ( ret === "" && !jQuery.contains( elem.ownerDocument, elem ) ) { |
|
6172
|
|
|
ret = jQuery.style( elem, name ); |
|
6173
|
|
|
} |
|
6174
|
|
|
|
|
6175
|
|
|
// A tribute to the "awesome hack by Dean Edwards" |
|
6176
|
|
|
// Android Browser returns percentage for some values, |
|
6177
|
|
|
// but width seems to be reliably pixels. |
|
6178
|
|
|
// This is against the CSSOM draft spec: |
|
6179
|
|
|
// https://drafts.csswg.org/cssom/#resolved-values |
|
6180
|
|
|
if ( !support.pixelMarginRight() && rnumnonpx.test( ret ) && rmargin.test( name ) ) { |
|
6181
|
|
|
|
|
6182
|
|
|
// Remember the original values |
|
6183
|
|
|
width = style.width; |
|
6184
|
|
|
minWidth = style.minWidth; |
|
6185
|
|
|
maxWidth = style.maxWidth; |
|
6186
|
|
|
|
|
6187
|
|
|
// Put in the new values to get a computed value out |
|
6188
|
|
|
style.minWidth = style.maxWidth = style.width = ret; |
|
6189
|
|
|
ret = computed.width; |
|
6190
|
|
|
|
|
6191
|
|
|
// Revert the changed values |
|
6192
|
|
|
style.width = width; |
|
6193
|
|
|
style.minWidth = minWidth; |
|
6194
|
|
|
style.maxWidth = maxWidth; |
|
6195
|
|
|
} |
|
6196
|
|
|
} |
|
6197
|
|
|
|
|
6198
|
|
|
return ret !== undefined ? |
|
6199
|
|
|
|
|
6200
|
|
|
// Support: IE <=9 - 11 only |
|
6201
|
|
|
// IE returns zIndex value as an integer. |
|
6202
|
|
|
ret + "" : |
|
6203
|
|
|
ret; |
|
6204
|
|
|
} |
|
6205
|
|
|
|
|
6206
|
|
|
|
|
6207
|
|
|
function addGetHookIf( conditionFn, hookFn ) { |
|
6208
|
|
|
|
|
6209
|
|
|
// Define the hook, we'll check on the first run if it's really needed. |
|
6210
|
|
|
return { |
|
6211
|
|
|
get: function() { |
|
6212
|
|
|
if ( conditionFn() ) { |
|
6213
|
|
|
|
|
6214
|
|
|
// Hook not needed (or it's not possible to use it due |
|
6215
|
|
|
// to missing dependency), remove it. |
|
6216
|
|
|
delete this.get; |
|
6217
|
|
|
return; |
|
6218
|
|
|
} |
|
6219
|
|
|
|
|
6220
|
|
|
// Hook needed; redefine it so that the support test is not executed again. |
|
6221
|
|
|
return ( this.get = hookFn ).apply( this, arguments ); |
|
6222
|
|
|
} |
|
6223
|
|
|
}; |
|
6224
|
|
|
} |
|
6225
|
|
|
|
|
6226
|
|
|
|
|
6227
|
|
|
var |
|
6228
|
|
|
|
|
6229
|
|
|
// Swappable if display is none or starts with table |
|
6230
|
|
|
// except "table", "table-cell", or "table-caption" |
|
6231
|
|
|
// See here for display values: https://developer.mozilla.org/en-US/docs/CSS/display |
|
6232
|
|
|
rdisplayswap = /^(none|table(?!-c[ea]).+)/, |
|
6233
|
|
|
cssShow = { position: "absolute", visibility: "hidden", display: "block" }, |
|
6234
|
|
|
cssNormalTransform = { |
|
6235
|
|
|
letterSpacing: "0", |
|
6236
|
|
|
fontWeight: "400" |
|
6237
|
|
|
}, |
|
6238
|
|
|
|
|
6239
|
|
|
cssPrefixes = [ "Webkit", "Moz", "ms" ], |
|
6240
|
|
|
emptyStyle = document.createElement( "div" ).style; |
|
6241
|
|
|
|
|
6242
|
|
|
// Return a css property mapped to a potentially vendor prefixed property |
|
6243
|
|
|
function vendorPropName( name ) { |
|
6244
|
|
|
|
|
6245
|
|
|
// Shortcut for names that are not vendor prefixed |
|
6246
|
|
|
if ( name in emptyStyle ) { |
|
6247
|
|
|
return name; |
|
6248
|
|
|
} |
|
6249
|
|
|
|
|
6250
|
|
|
// Check for vendor prefixed names |
|
6251
|
|
|
var capName = name[ 0 ].toUpperCase() + name.slice( 1 ), |
|
6252
|
|
|
i = cssPrefixes.length; |
|
6253
|
|
|
|
|
6254
|
|
|
while ( i-- ) { |
|
6255
|
|
|
name = cssPrefixes[ i ] + capName; |
|
6256
|
|
|
if ( name in emptyStyle ) { |
|
6257
|
|
|
return name; |
|
6258
|
|
|
} |
|
6259
|
|
|
} |
|
6260
|
|
|
} |
|
6261
|
|
|
|
|
6262
|
|
|
function setPositiveNumber( elem, value, subtract ) { |
|
6263
|
|
|
|
|
6264
|
|
|
// Any relative (+/-) values have already been |
|
6265
|
|
|
// normalized at this point |
|
6266
|
|
|
var matches = rcssNum.exec( value ); |
|
6267
|
|
|
return matches ? |
|
6268
|
|
|
|
|
6269
|
|
|
// Guard against undefined "subtract", e.g., when used as in cssHooks |
|
6270
|
|
|
Math.max( 0, matches[ 2 ] - ( subtract || 0 ) ) + ( matches[ 3 ] || "px" ) : |
|
6271
|
|
|
value; |
|
6272
|
|
|
} |
|
6273
|
|
|
|
|
6274
|
|
|
function augmentWidthOrHeight( elem, name, extra, isBorderBox, styles ) { |
|
6275
|
|
|
var i, |
|
6276
|
|
|
val = 0; |
|
6277
|
|
|
|
|
6278
|
|
|
// If we already have the right measurement, avoid augmentation |
|
6279
|
|
|
if ( extra === ( isBorderBox ? "border" : "content" ) ) { |
|
6280
|
|
|
i = 4; |
|
6281
|
|
|
|
|
6282
|
|
|
// Otherwise initialize for horizontal or vertical properties |
|
6283
|
|
|
} else { |
|
6284
|
|
|
i = name === "width" ? 1 : 0; |
|
6285
|
|
|
} |
|
6286
|
|
|
|
|
6287
|
|
|
for ( ; i < 4; i += 2 ) { |
|
6288
|
|
|
|
|
6289
|
|
|
// Both box models exclude margin, so add it if we want it |
|
6290
|
|
|
if ( extra === "margin" ) { |
|
6291
|
|
|
val += jQuery.css( elem, extra + cssExpand[ i ], true, styles ); |
|
6292
|
|
|
} |
|
6293
|
|
|
|
|
6294
|
|
|
if ( isBorderBox ) { |
|
6295
|
|
|
|
|
6296
|
|
|
// border-box includes padding, so remove it if we want content |
|
6297
|
|
|
if ( extra === "content" ) { |
|
6298
|
|
|
val -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles ); |
|
6299
|
|
|
} |
|
6300
|
|
|
|
|
6301
|
|
|
// At this point, extra isn't border nor margin, so remove border |
|
6302
|
|
|
if ( extra !== "margin" ) { |
|
6303
|
|
|
val -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles ); |
|
6304
|
|
|
} |
|
6305
|
|
|
} else { |
|
6306
|
|
|
|
|
6307
|
|
|
// At this point, extra isn't content, so add padding |
|
6308
|
|
|
val += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles ); |
|
6309
|
|
|
|
|
6310
|
|
|
// At this point, extra isn't content nor padding, so add border |
|
6311
|
|
|
if ( extra !== "padding" ) { |
|
6312
|
|
|
val += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles ); |
|
6313
|
|
|
} |
|
6314
|
|
|
} |
|
6315
|
|
|
} |
|
6316
|
|
|
|
|
6317
|
|
|
return val; |
|
6318
|
|
|
} |
|
6319
|
|
|
|
|
6320
|
|
|
function getWidthOrHeight( elem, name, extra ) { |
|
6321
|
|
|
|
|
6322
|
|
|
// Start with offset property, which is equivalent to the border-box value |
|
6323
|
|
|
var val, |
|
6324
|
|
|
valueIsBorderBox = true, |
|
6325
|
|
|
styles = getStyles( elem ), |
|
6326
|
|
|
isBorderBox = jQuery.css( elem, "boxSizing", false, styles ) === "border-box"; |
|
6327
|
|
|
|
|
6328
|
|
|
// Support: IE <=11 only |
|
6329
|
|
|
// Running getBoundingClientRect on a disconnected node |
|
6330
|
|
|
// in IE throws an error. |
|
6331
|
|
|
if ( elem.getClientRects().length ) { |
|
6332
|
|
|
val = elem.getBoundingClientRect()[ name ]; |
|
6333
|
|
|
} |
|
6334
|
|
|
|
|
6335
|
|
|
// Some non-html elements return undefined for offsetWidth, so check for null/undefined |
|
6336
|
|
|
// svg - https://bugzilla.mozilla.org/show_bug.cgi?id=649285 |
|
6337
|
|
|
// MathML - https://bugzilla.mozilla.org/show_bug.cgi?id=491668 |
|
6338
|
|
|
if ( val <= 0 || val == null ) { |
|
6339
|
|
|
|
|
6340
|
|
|
// Fall back to computed then uncomputed css if necessary |
|
6341
|
|
|
val = curCSS( elem, name, styles ); |
|
6342
|
|
|
if ( val < 0 || val == null ) { |
|
6343
|
|
|
val = elem.style[ name ]; |
|
6344
|
|
|
} |
|
6345
|
|
|
|
|
6346
|
|
|
// Computed unit is not pixels. Stop here and return. |
|
6347
|
|
|
if ( rnumnonpx.test( val ) ) { |
|
6348
|
|
|
return val; |
|
6349
|
|
|
} |
|
6350
|
|
|
|
|
6351
|
|
|
// Check for style in case a browser which returns unreliable values |
|
6352
|
|
|
// for getComputedStyle silently falls back to the reliable elem.style |
|
6353
|
|
|
valueIsBorderBox = isBorderBox && |
|
6354
|
|
|
( support.boxSizingReliable() || val === elem.style[ name ] ); |
|
6355
|
|
|
|
|
6356
|
|
|
// Normalize "", auto, and prepare for extra |
|
6357
|
|
|
val = parseFloat( val ) || 0; |
|
6358
|
|
|
} |
|
6359
|
|
|
|
|
6360
|
|
|
// Use the active box-sizing model to add/subtract irrelevant styles |
|
6361
|
|
|
return ( val + |
|
6362
|
|
|
augmentWidthOrHeight( |
|
6363
|
|
|
elem, |
|
6364
|
|
|
name, |
|
6365
|
|
|
extra || ( isBorderBox ? "border" : "content" ), |
|
6366
|
|
|
valueIsBorderBox, |
|
6367
|
|
|
styles |
|
6368
|
|
|
) |
|
6369
|
|
|
) + "px"; |
|
6370
|
|
|
} |
|
6371
|
|
|
|
|
6372
|
|
|
jQuery.extend( { |
|
6373
|
|
|
|
|
6374
|
|
|
// Add in style property hooks for overriding the default |
|
6375
|
|
|
// behavior of getting and setting a style property |
|
6376
|
|
|
cssHooks: { |
|
6377
|
|
|
opacity: { |
|
6378
|
|
|
get: function( elem, computed ) { |
|
6379
|
|
|
if ( computed ) { |
|
6380
|
|
|
|
|
6381
|
|
|
// We should always get a number back from opacity |
|
6382
|
|
|
var ret = curCSS( elem, "opacity" ); |
|
6383
|
|
|
return ret === "" ? "1" : ret; |
|
6384
|
|
|
} |
|
6385
|
|
|
} |
|
6386
|
|
|
} |
|
6387
|
|
|
}, |
|
6388
|
|
|
|
|
6389
|
|
|
// Don't automatically add "px" to these possibly-unitless properties |
|
6390
|
|
|
cssNumber: { |
|
6391
|
|
|
"animationIterationCount": true, |
|
6392
|
|
|
"columnCount": true, |
|
6393
|
|
|
"fillOpacity": true, |
|
6394
|
|
|
"flexGrow": true, |
|
6395
|
|
|
"flexShrink": true, |
|
6396
|
|
|
"fontWeight": true, |
|
6397
|
|
|
"lineHeight": true, |
|
6398
|
|
|
"opacity": true, |
|
6399
|
|
|
"order": true, |
|
6400
|
|
|
"orphans": true, |
|
6401
|
|
|
"widows": true, |
|
6402
|
|
|
"zIndex": true, |
|
6403
|
|
|
"zoom": true |
|
6404
|
|
|
}, |
|
6405
|
|
|
|
|
6406
|
|
|
// Add in properties whose names you wish to fix before |
|
6407
|
|
|
// setting or getting the value |
|
6408
|
|
|
cssProps: { |
|
6409
|
|
|
"float": "cssFloat" |
|
6410
|
|
|
}, |
|
6411
|
|
|
|
|
6412
|
|
|
// Get and set the style property on a DOM Node |
|
6413
|
|
|
style: function( elem, name, value, extra ) { |
|
6414
|
|
|
|
|
6415
|
|
|
// Don't set styles on text and comment nodes |
|
6416
|
|
|
if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) { |
|
6417
|
|
|
return; |
|
6418
|
|
|
} |
|
6419
|
|
|
|
|
6420
|
|
|
// Make sure that we're working with the right name |
|
6421
|
|
|
var ret, type, hooks, |
|
6422
|
|
|
origName = jQuery.camelCase( name ), |
|
6423
|
|
|
style = elem.style; |
|
6424
|
|
|
|
|
6425
|
|
|
name = jQuery.cssProps[ origName ] || |
|
6426
|
|
|
( jQuery.cssProps[ origName ] = vendorPropName( origName ) || origName ); |
|
6427
|
|
|
|
|
6428
|
|
|
// Gets hook for the prefixed version, then unprefixed version |
|
6429
|
|
|
hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ]; |
|
6430
|
|
|
|
|
6431
|
|
|
// Check if we're setting a value |
|
6432
|
|
|
if ( value !== undefined ) { |
|
6433
|
|
|
type = typeof value; |
|
6434
|
|
|
|
|
6435
|
|
|
// Convert "+=" or "-=" to relative numbers (#7345) |
|
6436
|
|
|
if ( type === "string" && ( ret = rcssNum.exec( value ) ) && ret[ 1 ] ) { |
|
6437
|
|
|
value = adjustCSS( elem, name, ret ); |
|
6438
|
|
|
|
|
6439
|
|
|
// Fixes bug #9237 |
|
6440
|
|
|
type = "number"; |
|
6441
|
|
|
} |
|
6442
|
|
|
|
|
6443
|
|
|
// Make sure that null and NaN values aren't set (#7116) |
|
6444
|
|
|
if ( value == null || value !== value ) { |
|
6445
|
|
|
return; |
|
6446
|
|
|
} |
|
6447
|
|
|
|
|
6448
|
|
|
// If a number was passed in, add the unit (except for certain CSS properties) |
|
6449
|
|
|
if ( type === "number" ) { |
|
6450
|
|
|
value += ret && ret[ 3 ] || ( jQuery.cssNumber[ origName ] ? "" : "px" ); |
|
6451
|
|
|
} |
|
6452
|
|
|
|
|
6453
|
|
|
// background-* props affect original clone's values |
|
6454
|
|
|
if ( !support.clearCloneStyle && value === "" && name.indexOf( "background" ) === 0 ) { |
|
6455
|
|
|
style[ name ] = "inherit"; |
|
6456
|
|
|
} |
|
6457
|
|
|
|
|
6458
|
|
|
// If a hook was provided, use that value, otherwise just set the specified value |
|
6459
|
|
|
if ( !hooks || !( "set" in hooks ) || |
|
6460
|
|
|
( value = hooks.set( elem, value, extra ) ) !== undefined ) { |
|
6461
|
|
|
|
|
6462
|
|
|
style[ name ] = value; |
|
6463
|
|
|
} |
|
6464
|
|
|
|
|
6465
|
|
|
} else { |
|
6466
|
|
|
|
|
6467
|
|
|
// If a hook was provided get the non-computed value from there |
|
6468
|
|
|
if ( hooks && "get" in hooks && |
|
6469
|
|
|
( ret = hooks.get( elem, false, extra ) ) !== undefined ) { |
|
6470
|
|
|
|
|
6471
|
|
|
return ret; |
|
6472
|
|
|
} |
|
6473
|
|
|
|
|
6474
|
|
|
// Otherwise just get the value from the style object |
|
6475
|
|
|
return style[ name ]; |
|
6476
|
|
|
} |
|
6477
|
|
|
}, |
|
6478
|
|
|
|
|
6479
|
|
|
css: function( elem, name, extra, styles ) { |
|
6480
|
|
|
var val, num, hooks, |
|
6481
|
|
|
origName = jQuery.camelCase( name ); |
|
6482
|
|
|
|
|
6483
|
|
|
// Make sure that we're working with the right name |
|
6484
|
|
|
name = jQuery.cssProps[ origName ] || |
|
6485
|
|
|
( jQuery.cssProps[ origName ] = vendorPropName( origName ) || origName ); |
|
6486
|
|
|
|
|
6487
|
|
|
// Try prefixed name followed by the unprefixed name |
|
6488
|
|
|
hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ]; |
|
6489
|
|
|
|
|
6490
|
|
|
// If a hook was provided get the computed value from there |
|
6491
|
|
|
if ( hooks && "get" in hooks ) { |
|
6492
|
|
|
val = hooks.get( elem, true, extra ); |
|
6493
|
|
|
} |
|
6494
|
|
|
|
|
6495
|
|
|
// Otherwise, if a way to get the computed value exists, use that |
|
6496
|
|
|
if ( val === undefined ) { |
|
6497
|
|
|
val = curCSS( elem, name, styles ); |
|
6498
|
|
|
} |
|
6499
|
|
|
|
|
6500
|
|
|
// Convert "normal" to computed value |
|
6501
|
|
|
if ( val === "normal" && name in cssNormalTransform ) { |
|
6502
|
|
|
val = cssNormalTransform[ name ]; |
|
6503
|
|
|
} |
|
6504
|
|
|
|
|
6505
|
|
|
// Make numeric if forced or a qualifier was provided and val looks numeric |
|
6506
|
|
|
if ( extra === "" || extra ) { |
|
6507
|
|
|
num = parseFloat( val ); |
|
6508
|
|
|
return extra === true || isFinite( num ) ? num || 0 : val; |
|
6509
|
|
|
} |
|
6510
|
|
|
return val; |
|
6511
|
|
|
} |
|
6512
|
|
|
} ); |
|
6513
|
|
|
|
|
6514
|
|
|
jQuery.each( [ "height", "width" ], function( i, name ) { |
|
6515
|
|
|
jQuery.cssHooks[ name ] = { |
|
6516
|
|
|
get: function( elem, computed, extra ) { |
|
6517
|
|
|
if ( computed ) { |
|
6518
|
|
|
|
|
6519
|
|
|
// Certain elements can have dimension info if we invisibly show them |
|
6520
|
|
|
// but it must have a current display style that would benefit |
|
6521
|
|
|
return rdisplayswap.test( jQuery.css( elem, "display" ) ) && |
|
6522
|
|
|
|
|
6523
|
|
|
// Support: Safari 8+ |
|
6524
|
|
|
// Table columns in Safari have non-zero offsetWidth & zero |
|
6525
|
|
|
// getBoundingClientRect().width unless display is changed. |
|
6526
|
|
|
// Support: IE <=11 only |
|
6527
|
|
|
// Running getBoundingClientRect on a disconnected node |
|
6528
|
|
|
// in IE throws an error. |
|
6529
|
|
|
( !elem.getClientRects().length || !elem.getBoundingClientRect().width ) ? |
|
6530
|
|
|
swap( elem, cssShow, function() { |
|
6531
|
|
|
return getWidthOrHeight( elem, name, extra ); |
|
6532
|
|
|
} ) : |
|
6533
|
|
|
getWidthOrHeight( elem, name, extra ); |
|
6534
|
|
|
} |
|
6535
|
|
|
}, |
|
6536
|
|
|
|
|
6537
|
|
|
set: function( elem, value, extra ) { |
|
6538
|
|
|
var matches, |
|
6539
|
|
|
styles = extra && getStyles( elem ), |
|
6540
|
|
|
subtract = extra && augmentWidthOrHeight( |
|
6541
|
|
|
elem, |
|
6542
|
|
|
name, |
|
6543
|
|
|
extra, |
|
6544
|
|
|
jQuery.css( elem, "boxSizing", false, styles ) === "border-box", |
|
6545
|
|
|
styles |
|
6546
|
|
|
); |
|
6547
|
|
|
|
|
6548
|
|
|
// Convert to pixels if value adjustment is needed |
|
6549
|
|
|
if ( subtract && ( matches = rcssNum.exec( value ) ) && |
|
6550
|
|
|
( matches[ 3 ] || "px" ) !== "px" ) { |
|
6551
|
|
|
|
|
6552
|
|
|
elem.style[ name ] = value; |
|
6553
|
|
|
value = jQuery.css( elem, name ); |
|
6554
|
|
|
} |
|
6555
|
|
|
|
|
6556
|
|
|
return setPositiveNumber( elem, value, subtract ); |
|
6557
|
|
|
} |
|
6558
|
|
|
}; |
|
6559
|
|
|
} ); |
|
6560
|
|
|
|
|
6561
|
|
|
jQuery.cssHooks.marginLeft = addGetHookIf( support.reliableMarginLeft, |
|
6562
|
|
|
function( elem, computed ) { |
|
6563
|
|
|
if ( computed ) { |
|
6564
|
|
|
return ( parseFloat( curCSS( elem, "marginLeft" ) ) || |
|
6565
|
|
|
elem.getBoundingClientRect().left - |
|
6566
|
|
|
swap( elem, { marginLeft: 0 }, function() { |
|
6567
|
|
|
return elem.getBoundingClientRect().left; |
|
6568
|
|
|
} ) |
|
6569
|
|
|
) + "px"; |
|
6570
|
|
|
} |
|
6571
|
|
|
} |
|
6572
|
|
|
); |
|
6573
|
|
|
|
|
6574
|
|
|
// These hooks are used by animate to expand properties |
|
6575
|
|
|
jQuery.each( { |
|
6576
|
|
|
margin: "", |
|
6577
|
|
|
padding: "", |
|
6578
|
|
|
border: "Width" |
|
6579
|
|
|
}, function( prefix, suffix ) { |
|
6580
|
|
|
jQuery.cssHooks[ prefix + suffix ] = { |
|
6581
|
|
|
expand: function( value ) { |
|
6582
|
|
|
var i = 0, |
|
6583
|
|
|
expanded = {}, |
|
6584
|
|
|
|
|
6585
|
|
|
// Assumes a single number if not a string |
|
6586
|
|
|
parts = typeof value === "string" ? value.split( " " ) : [ value ]; |
|
6587
|
|
|
|
|
6588
|
|
|
for ( ; i < 4; i++ ) { |
|
6589
|
|
|
expanded[ prefix + cssExpand[ i ] + suffix ] = |
|
6590
|
|
|
parts[ i ] || parts[ i - 2 ] || parts[ 0 ]; |
|
6591
|
|
|
} |
|
6592
|
|
|
|
|
6593
|
|
|
return expanded; |
|
6594
|
|
|
} |
|
6595
|
|
|
}; |
|
6596
|
|
|
|
|
6597
|
|
|
if ( !rmargin.test( prefix ) ) { |
|
6598
|
|
|
jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber; |
|
6599
|
|
|
} |
|
6600
|
|
|
} ); |
|
6601
|
|
|
|
|
6602
|
|
|
jQuery.fn.extend( { |
|
6603
|
|
|
css: function( name, value ) { |
|
6604
|
|
|
return access( this, function( elem, name, value ) { |
|
6605
|
|
|
var styles, len, |
|
6606
|
|
|
map = {}, |
|
6607
|
|
|
i = 0; |
|
6608
|
|
|
|
|
6609
|
|
|
if ( jQuery.isArray( name ) ) { |
|
6610
|
|
|
styles = getStyles( elem ); |
|
6611
|
|
|
len = name.length; |
|
6612
|
|
|
|
|
6613
|
|
|
for ( ; i < len; i++ ) { |
|
6614
|
|
|
map[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles ); |
|
6615
|
|
|
} |
|
6616
|
|
|
|
|
6617
|
|
|
return map; |
|
6618
|
|
|
} |
|
6619
|
|
|
|
|
6620
|
|
|
return value !== undefined ? |
|
6621
|
|
|
jQuery.style( elem, name, value ) : |
|
6622
|
|
|
jQuery.css( elem, name ); |
|
6623
|
|
|
}, name, value, arguments.length > 1 ); |
|
6624
|
|
|
} |
|
6625
|
|
|
} ); |
|
6626
|
|
|
|
|
6627
|
|
|
|
|
6628
|
|
|
// Based off of the plugin by Clint Helfers, with permission. |
|
6629
|
|
|
// https://web.archive.org/web/20100324014747/http://blindsignals.com/index.php/2009/07/jquery-delay/ |
|
6630
|
|
|
jQuery.fn.delay = function( time, type ) { |
|
6631
|
|
|
time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time; |
|
6632
|
|
|
type = type || "fx"; |
|
6633
|
|
|
|
|
6634
|
|
|
return this.queue( type, function( next, hooks ) { |
|
6635
|
|
|
var timeout = window.setTimeout( next, time ); |
|
6636
|
|
|
hooks.stop = function() { |
|
6637
|
|
|
window.clearTimeout( timeout ); |
|
6638
|
|
|
}; |
|
6639
|
|
|
} ); |
|
6640
|
|
|
}; |
|
6641
|
|
|
|
|
6642
|
|
|
|
|
6643
|
|
|
( function() { |
|
6644
|
|
|
var input = document.createElement( "input" ), |
|
6645
|
|
|
select = document.createElement( "select" ), |
|
6646
|
|
|
opt = select.appendChild( document.createElement( "option" ) ); |
|
6647
|
|
|
|
|
6648
|
|
|
input.type = "checkbox"; |
|
6649
|
|
|
|
|
6650
|
|
|
// Support: Android <=4.3 only |
|
6651
|
|
|
// Default value for a checkbox should be "on" |
|
6652
|
|
|
support.checkOn = input.value !== ""; |
|
6653
|
|
|
|
|
6654
|
|
|
// Support: IE <=11 only |
|
6655
|
|
|
// Must access selectedIndex to make default options select |
|
6656
|
|
|
support.optSelected = opt.selected; |
|
6657
|
|
|
|
|
6658
|
|
|
// Support: IE <=11 only |
|
6659
|
|
|
// An input loses its value after becoming a radio |
|
6660
|
|
|
input = document.createElement( "input" ); |
|
6661
|
|
|
input.value = "t"; |
|
6662
|
|
|
input.type = "radio"; |
|
6663
|
|
|
support.radioValue = input.value === "t"; |
|
6664
|
|
|
} )(); |
|
6665
|
|
|
|
|
6666
|
|
|
|
|
6667
|
|
|
var boolHook, |
|
6668
|
|
|
attrHandle = jQuery.expr.attrHandle; |
|
6669
|
|
|
|
|
6670
|
|
|
jQuery.fn.extend( { |
|
6671
|
|
|
attr: function( name, value ) { |
|
6672
|
|
|
return access( this, jQuery.attr, name, value, arguments.length > 1 ); |
|
6673
|
|
|
}, |
|
6674
|
|
|
|
|
6675
|
|
|
removeAttr: function( name ) { |
|
6676
|
|
|
return this.each( function() { |
|
6677
|
|
|
jQuery.removeAttr( this, name ); |
|
6678
|
|
|
} ); |
|
6679
|
|
|
} |
|
6680
|
|
|
} ); |
|
6681
|
|
|
|
|
6682
|
|
|
jQuery.extend( { |
|
6683
|
|
|
attr: function( elem, name, value ) { |
|
6684
|
|
|
var ret, hooks, |
|
6685
|
|
|
nType = elem.nodeType; |
|
6686
|
|
|
|
|
6687
|
|
|
// Don't get/set attributes on text, comment and attribute nodes |
|
6688
|
|
|
if ( nType === 3 || nType === 8 || nType === 2 ) { |
|
6689
|
|
|
return; |
|
6690
|
|
|
} |
|
6691
|
|
|
|
|
6692
|
|
|
// Fallback to prop when attributes are not supported |
|
6693
|
|
|
if ( typeof elem.getAttribute === "undefined" ) { |
|
6694
|
|
|
return jQuery.prop( elem, name, value ); |
|
6695
|
|
|
} |
|
6696
|
|
|
|
|
6697
|
|
|
// Attribute hooks are determined by the lowercase version |
|
6698
|
|
|
// Grab necessary hook if one is defined |
|
6699
|
|
|
if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) { |
|
6700
|
|
|
hooks = jQuery.attrHooks[ name.toLowerCase() ] || |
|
6701
|
|
|
( jQuery.expr.match.bool.test( name ) ? boolHook : undefined ); |
|
6702
|
|
|
} |
|
6703
|
|
|
|
|
6704
|
|
|
if ( value !== undefined ) { |
|
6705
|
|
|
if ( value === null ) { |
|
6706
|
|
|
jQuery.removeAttr( elem, name ); |
|
6707
|
|
|
return; |
|
6708
|
|
|
} |
|
6709
|
|
|
|
|
6710
|
|
|
if ( hooks && "set" in hooks && |
|
6711
|
|
|
( ret = hooks.set( elem, value, name ) ) !== undefined ) { |
|
6712
|
|
|
return ret; |
|
6713
|
|
|
} |
|
6714
|
|
|
|
|
6715
|
|
|
elem.setAttribute( name, value + "" ); |
|
6716
|
|
|
return value; |
|
6717
|
|
|
} |
|
6718
|
|
|
|
|
6719
|
|
|
if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) { |
|
6720
|
|
|
return ret; |
|
6721
|
|
|
} |
|
6722
|
|
|
|
|
6723
|
|
|
ret = jQuery.find.attr( elem, name ); |
|
6724
|
|
|
|
|
6725
|
|
|
// Non-existent attributes return null, we normalize to undefined |
|
6726
|
|
|
return ret == null ? undefined : ret; |
|
6727
|
|
|
}, |
|
6728
|
|
|
|
|
6729
|
|
|
attrHooks: { |
|
6730
|
|
|
type: { |
|
6731
|
|
|
set: function( elem, value ) { |
|
6732
|
|
|
if ( !support.radioValue && value === "radio" && |
|
6733
|
|
|
jQuery.nodeName( elem, "input" ) ) { |
|
6734
|
|
|
var val = elem.value; |
|
6735
|
|
|
elem.setAttribute( "type", value ); |
|
6736
|
|
|
if ( val ) { |
|
6737
|
|
|
elem.value = val; |
|
6738
|
|
|
} |
|
6739
|
|
|
return value; |
|
6740
|
|
|
} |
|
6741
|
|
|
} |
|
6742
|
|
|
} |
|
6743
|
|
|
}, |
|
6744
|
|
|
|
|
6745
|
|
|
removeAttr: function( elem, value ) { |
|
6746
|
|
|
var name, |
|
6747
|
|
|
i = 0, |
|
6748
|
|
|
|
|
6749
|
|
|
// Attribute names can contain non-HTML whitespace characters |
|
6750
|
|
|
// https://html.spec.whatwg.org/multipage/syntax.html#attributes-2 |
|
6751
|
|
|
attrNames = value && value.match( rnothtmlwhite ); |
|
6752
|
|
|
|
|
6753
|
|
|
if ( attrNames && elem.nodeType === 1 ) { |
|
6754
|
|
|
while ( ( name = attrNames[ i++ ] ) ) { |
|
6755
|
|
|
elem.removeAttribute( name ); |
|
6756
|
|
|
} |
|
6757
|
|
|
} |
|
6758
|
|
|
} |
|
6759
|
|
|
} ); |
|
6760
|
|
|
|
|
6761
|
|
|
// Hooks for boolean attributes |
|
6762
|
|
|
boolHook = { |
|
6763
|
|
|
set: function( elem, value, name ) { |
|
6764
|
|
|
if ( value === false ) { |
|
6765
|
|
|
|
|
6766
|
|
|
// Remove boolean attributes when set to false |
|
6767
|
|
|
jQuery.removeAttr( elem, name ); |
|
6768
|
|
|
} else { |
|
6769
|
|
|
elem.setAttribute( name, name ); |
|
6770
|
|
|
} |
|
6771
|
|
|
return name; |
|
6772
|
|
|
} |
|
6773
|
|
|
}; |
|
6774
|
|
|
|
|
6775
|
|
|
jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( i, name ) { |
|
6776
|
|
|
var getter = attrHandle[ name ] || jQuery.find.attr; |
|
6777
|
|
|
|
|
6778
|
|
|
attrHandle[ name ] = function( elem, name, isXML ) { |
|
6779
|
|
|
var ret, handle, |
|
6780
|
|
|
lowercaseName = name.toLowerCase(); |
|
6781
|
|
|
|
|
6782
|
|
|
if ( !isXML ) { |
|
6783
|
|
|
|
|
6784
|
|
|
// Avoid an infinite loop by temporarily removing this function from the getter |
|
6785
|
|
|
handle = attrHandle[ lowercaseName ]; |
|
6786
|
|
|
attrHandle[ lowercaseName ] = ret; |
|
6787
|
|
|
ret = getter( elem, name, isXML ) != null ? |
|
6788
|
|
|
lowercaseName : |
|
6789
|
|
|
null; |
|
6790
|
|
|
attrHandle[ lowercaseName ] = handle; |
|
6791
|
|
|
} |
|
6792
|
|
|
return ret; |
|
6793
|
|
|
}; |
|
6794
|
|
|
} ); |
|
6795
|
|
|
|
|
6796
|
|
|
|
|
6797
|
|
|
|
|
6798
|
|
|
|
|
6799
|
|
|
var rfocusable = /^(?:input|select|textarea|button)$/i, |
|
6800
|
|
|
rclickable = /^(?:a|area)$/i; |
|
6801
|
|
|
|
|
6802
|
|
|
jQuery.fn.extend( { |
|
6803
|
|
|
prop: function( name, value ) { |
|
6804
|
|
|
return access( this, jQuery.prop, name, value, arguments.length > 1 ); |
|
6805
|
|
|
}, |
|
6806
|
|
|
|
|
6807
|
|
|
removeProp: function( name ) { |
|
6808
|
|
|
return this.each( function() { |
|
6809
|
|
|
delete this[ jQuery.propFix[ name ] || name ]; |
|
6810
|
|
|
} ); |
|
6811
|
|
|
} |
|
6812
|
|
|
} ); |
|
6813
|
|
|
|
|
6814
|
|
|
jQuery.extend( { |
|
6815
|
|
|
prop: function( elem, name, value ) { |
|
6816
|
|
|
var ret, hooks, |
|
6817
|
|
|
nType = elem.nodeType; |
|
6818
|
|
|
|
|
6819
|
|
|
// Don't get/set properties on text, comment and attribute nodes |
|
6820
|
|
|
if ( nType === 3 || nType === 8 || nType === 2 ) { |
|
6821
|
|
|
return; |
|
6822
|
|
|
} |
|
6823
|
|
|
|
|
6824
|
|
|
if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) { |
|
6825
|
|
|
|
|
6826
|
|
|
// Fix name and attach hooks |
|
6827
|
|
|
name = jQuery.propFix[ name ] || name; |
|
6828
|
|
|
hooks = jQuery.propHooks[ name ]; |
|
6829
|
|
|
} |
|
6830
|
|
|
|
|
6831
|
|
|
if ( value !== undefined ) { |
|
6832
|
|
|
if ( hooks && "set" in hooks && |
|
6833
|
|
|
( ret = hooks.set( elem, value, name ) ) !== undefined ) { |
|
6834
|
|
|
return ret; |
|
6835
|
|
|
} |
|
6836
|
|
|
|
|
6837
|
|
|
return ( elem[ name ] = value ); |
|
6838
|
|
|
} |
|
6839
|
|
|
|
|
6840
|
|
|
if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) { |
|
6841
|
|
|
return ret; |
|
6842
|
|
|
} |
|
6843
|
|
|
|
|
6844
|
|
|
return elem[ name ]; |
|
6845
|
|
|
}, |
|
6846
|
|
|
|
|
6847
|
|
|
propHooks: { |
|
6848
|
|
|
tabIndex: { |
|
6849
|
|
|
get: function( elem ) { |
|
6850
|
|
|
|
|
6851
|
|
|
// Support: IE <=9 - 11 only |
|
6852
|
|
|
// elem.tabIndex doesn't always return the |
|
6853
|
|
|
// correct value when it hasn't been explicitly set |
|
6854
|
|
|
// https://web.archive.org/web/20141116233347/http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/ |
|
6855
|
|
|
// Use proper attribute retrieval(#12072) |
|
6856
|
|
|
var tabindex = jQuery.find.attr( elem, "tabindex" ); |
|
6857
|
|
|
|
|
6858
|
|
|
if ( tabindex ) { |
|
6859
|
|
|
return parseInt( tabindex, 10 ); |
|
6860
|
|
|
} |
|
6861
|
|
|
|
|
6862
|
|
|
if ( |
|
6863
|
|
|
rfocusable.test( elem.nodeName ) || |
|
6864
|
|
|
rclickable.test( elem.nodeName ) && |
|
6865
|
|
|
elem.href |
|
6866
|
|
|
) { |
|
6867
|
|
|
return 0; |
|
6868
|
|
|
} |
|
6869
|
|
|
|
|
6870
|
|
|
return -1; |
|
6871
|
|
|
} |
|
6872
|
|
|
} |
|
6873
|
|
|
}, |
|
6874
|
|
|
|
|
6875
|
|
|
propFix: { |
|
6876
|
|
|
"for": "htmlFor", |
|
6877
|
|
|
"class": "className" |
|
6878
|
|
|
} |
|
6879
|
|
|
} ); |
|
6880
|
|
|
|
|
6881
|
|
|
// Support: IE <=11 only |
|
6882
|
|
|
// Accessing the selectedIndex property |
|
6883
|
|
|
// forces the browser to respect setting selected |
|
6884
|
|
|
// on the option |
|
6885
|
|
|
// The getter ensures a default option is selected |
|
6886
|
|
|
// when in an optgroup |
|
6887
|
|
|
// eslint rule "no-unused-expressions" is disabled for this code |
|
6888
|
|
|
// since it considers such accessions noop |
|
6889
|
|
|
if ( !support.optSelected ) { |
|
6890
|
|
|
jQuery.propHooks.selected = { |
|
6891
|
|
|
get: function( elem ) { |
|
6892
|
|
|
|
|
6893
|
|
|
/* eslint no-unused-expressions: "off" */ |
|
6894
|
|
|
|
|
6895
|
|
|
var parent = elem.parentNode; |
|
6896
|
|
|
if ( parent && parent.parentNode ) { |
|
6897
|
|
|
parent.parentNode.selectedIndex; |
|
6898
|
|
|
} |
|
6899
|
|
|
return null; |
|
6900
|
|
|
}, |
|
6901
|
|
|
set: function( elem ) { |
|
6902
|
|
|
|
|
6903
|
|
|
/* eslint no-unused-expressions: "off" */ |
|
6904
|
|
|
|
|
6905
|
|
|
var parent = elem.parentNode; |
|
6906
|
|
|
if ( parent ) { |
|
6907
|
|
|
parent.selectedIndex; |
|
6908
|
|
|
|
|
6909
|
|
|
if ( parent.parentNode ) { |
|
6910
|
|
|
parent.parentNode.selectedIndex; |
|
6911
|
|
|
} |
|
6912
|
|
|
} |
|
6913
|
|
|
} |
|
6914
|
|
|
}; |
|
6915
|
|
|
} |
|
6916
|
|
|
|
|
6917
|
|
|
jQuery.each( [ |
|
6918
|
|
|
"tabIndex", |
|
6919
|
|
|
"readOnly", |
|
6920
|
|
|
"maxLength", |
|
6921
|
|
|
"cellSpacing", |
|
6922
|
|
|
"cellPadding", |
|
6923
|
|
|
"rowSpan", |
|
6924
|
|
|
"colSpan", |
|
6925
|
|
|
"useMap", |
|
6926
|
|
|
"frameBorder", |
|
6927
|
|
|
"contentEditable" |
|
6928
|
|
|
], function() { |
|
6929
|
|
|
jQuery.propFix[ this.toLowerCase() ] = this; |
|
6930
|
|
|
} ); |
|
6931
|
|
|
|
|
6932
|
|
|
|
|
6933
|
|
|
|
|
6934
|
|
|
|
|
6935
|
|
|
// Strip and collapse whitespace according to HTML spec |
|
6936
|
|
|
// https://html.spec.whatwg.org/multipage/infrastructure.html#strip-and-collapse-whitespace |
|
6937
|
|
|
function stripAndCollapse( value ) { |
|
6938
|
|
|
var tokens = value.match( rnothtmlwhite ) || []; |
|
6939
|
|
|
return tokens.join( " " ); |
|
6940
|
|
|
} |
|
6941
|
|
|
|
|
6942
|
|
|
|
|
6943
|
|
|
function getClass( elem ) { |
|
6944
|
|
|
return elem.getAttribute && elem.getAttribute( "class" ) || ""; |
|
6945
|
|
|
} |
|
6946
|
|
|
|
|
6947
|
|
|
jQuery.fn.extend( { |
|
6948
|
|
|
addClass: function( value ) { |
|
6949
|
|
|
var classes, elem, cur, curValue, clazz, j, finalValue, |
|
6950
|
|
|
i = 0; |
|
6951
|
|
|
|
|
6952
|
|
|
if ( jQuery.isFunction( value ) ) { |
|
6953
|
|
|
return this.each( function( j ) { |
|
6954
|
|
|
jQuery( this ).addClass( value.call( this, j, getClass( this ) ) ); |
|
6955
|
|
|
} ); |
|
6956
|
|
|
} |
|
6957
|
|
|
|
|
6958
|
|
|
if ( typeof value === "string" && value ) { |
|
6959
|
|
|
classes = value.match( rnothtmlwhite ) || []; |
|
6960
|
|
|
|
|
6961
|
|
|
while ( ( elem = this[ i++ ] ) ) { |
|
6962
|
|
|
curValue = getClass( elem ); |
|
6963
|
|
|
cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " ); |
|
6964
|
|
|
|
|
6965
|
|
|
if ( cur ) { |
|
6966
|
|
|
j = 0; |
|
6967
|
|
|
while ( ( clazz = classes[ j++ ] ) ) { |
|
6968
|
|
|
if ( cur.indexOf( " " + clazz + " " ) < 0 ) { |
|
6969
|
|
|
cur += clazz + " "; |
|
6970
|
|
|
} |
|
6971
|
|
|
} |
|
6972
|
|
|
|
|
6973
|
|
|
// Only assign if different to avoid unneeded rendering. |
|
6974
|
|
|
finalValue = stripAndCollapse( cur ); |
|
6975
|
|
|
if ( curValue !== finalValue ) { |
|
6976
|
|
|
elem.setAttribute( "class", finalValue ); |
|
6977
|
|
|
} |
|
6978
|
|
|
} |
|
6979
|
|
|
} |
|
6980
|
|
|
} |
|
6981
|
|
|
|
|
6982
|
|
|
return this; |
|
6983
|
|
|
}, |
|
6984
|
|
|
|
|
6985
|
|
|
removeClass: function( value ) { |
|
6986
|
|
|
var classes, elem, cur, curValue, clazz, j, finalValue, |
|
6987
|
|
|
i = 0; |
|
6988
|
|
|
|
|
6989
|
|
|
if ( jQuery.isFunction( value ) ) { |
|
6990
|
|
|
return this.each( function( j ) { |
|
6991
|
|
|
jQuery( this ).removeClass( value.call( this, j, getClass( this ) ) ); |
|
6992
|
|
|
} ); |
|
6993
|
|
|
} |
|
6994
|
|
|
|
|
6995
|
|
|
if ( !arguments.length ) { |
|
6996
|
|
|
return this.attr( "class", "" ); |
|
6997
|
|
|
} |
|
6998
|
|
|
|
|
6999
|
|
|
if ( typeof value === "string" && value ) { |
|
7000
|
|
|
classes = value.match( rnothtmlwhite ) || []; |
|
7001
|
|
|
|
|
7002
|
|
|
while ( ( elem = this[ i++ ] ) ) { |
|
7003
|
|
|
curValue = getClass( elem ); |
|
7004
|
|
|
|
|
7005
|
|
|
// This expression is here for better compressibility (see addClass) |
|
7006
|
|
|
cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " ); |
|
7007
|
|
|
|
|
7008
|
|
|
if ( cur ) { |
|
7009
|
|
|
j = 0; |
|
7010
|
|
|
while ( ( clazz = classes[ j++ ] ) ) { |
|
7011
|
|
|
|
|
7012
|
|
|
// Remove *all* instances |
|
7013
|
|
|
while ( cur.indexOf( " " + clazz + " " ) > -1 ) { |
|
7014
|
|
|
cur = cur.replace( " " + clazz + " ", " " ); |
|
7015
|
|
|
} |
|
7016
|
|
|
} |
|
7017
|
|
|
|
|
7018
|
|
|
// Only assign if different to avoid unneeded rendering. |
|
7019
|
|
|
finalValue = stripAndCollapse( cur ); |
|
7020
|
|
|
if ( curValue !== finalValue ) { |
|
7021
|
|
|
elem.setAttribute( "class", finalValue ); |
|
7022
|
|
|
} |
|
7023
|
|
|
} |
|
7024
|
|
|
} |
|
7025
|
|
|
} |
|
7026
|
|
|
|
|
7027
|
|
|
return this; |
|
7028
|
|
|
}, |
|
7029
|
|
|
|
|
7030
|
|
|
toggleClass: function( value, stateVal ) { |
|
7031
|
|
|
var type = typeof value; |
|
7032
|
|
|
|
|
7033
|
|
|
if ( typeof stateVal === "boolean" && type === "string" ) { |
|
7034
|
|
|
return stateVal ? this.addClass( value ) : this.removeClass( value ); |
|
7035
|
|
|
} |
|
7036
|
|
|
|
|
7037
|
|
|
if ( jQuery.isFunction( value ) ) { |
|
7038
|
|
|
return this.each( function( i ) { |
|
7039
|
|
|
jQuery( this ).toggleClass( |
|
7040
|
|
|
value.call( this, i, getClass( this ), stateVal ), |
|
7041
|
|
|
stateVal |
|
7042
|
|
|
); |
|
7043
|
|
|
} ); |
|
7044
|
|
|
} |
|
7045
|
|
|
|
|
7046
|
|
|
return this.each( function() { |
|
7047
|
|
|
var className, i, self, classNames; |
|
7048
|
|
|
|
|
7049
|
|
|
if ( type === "string" ) { |
|
7050
|
|
|
|
|
7051
|
|
|
// Toggle individual class names |
|
7052
|
|
|
i = 0; |
|
7053
|
|
|
self = jQuery( this ); |
|
7054
|
|
|
classNames = value.match( rnothtmlwhite ) || []; |
|
7055
|
|
|
|
|
7056
|
|
|
while ( ( className = classNames[ i++ ] ) ) { |
|
7057
|
|
|
|
|
7058
|
|
|
// Check each className given, space separated list |
|
7059
|
|
|
if ( self.hasClass( className ) ) { |
|
7060
|
|
|
self.removeClass( className ); |
|
7061
|
|
|
} else { |
|
7062
|
|
|
self.addClass( className ); |
|
7063
|
|
|
} |
|
7064
|
|
|
} |
|
7065
|
|
|
|
|
7066
|
|
|
// Toggle whole class name |
|
7067
|
|
|
} else if ( value === undefined || type === "boolean" ) { |
|
7068
|
|
|
className = getClass( this ); |
|
7069
|
|
|
if ( className ) { |
|
7070
|
|
|
|
|
7071
|
|
|
// Store className if set |
|
7072
|
|
|
dataPriv.set( this, "__className__", className ); |
|
7073
|
|
|
} |
|
7074
|
|
|
|
|
7075
|
|
|
// If the element has a class name or if we're passed `false`, |
|
7076
|
|
|
// then remove the whole classname (if there was one, the above saved it). |
|
7077
|
|
|
// Otherwise bring back whatever was previously saved (if anything), |
|
7078
|
|
|
// falling back to the empty string if nothing was stored. |
|
7079
|
|
|
if ( this.setAttribute ) { |
|
7080
|
|
|
this.setAttribute( "class", |
|
7081
|
|
|
className || value === false ? |
|
7082
|
|
|
"" : |
|
7083
|
|
|
dataPriv.get( this, "__className__" ) || "" |
|
7084
|
|
|
); |
|
7085
|
|
|
} |
|
7086
|
|
|
} |
|
7087
|
|
|
} ); |
|
7088
|
|
|
}, |
|
7089
|
|
|
|
|
7090
|
|
|
hasClass: function( selector ) { |
|
7091
|
|
|
var className, elem, |
|
7092
|
|
|
i = 0; |
|
7093
|
|
|
|
|
7094
|
|
|
className = " " + selector + " "; |
|
7095
|
|
|
while ( ( elem = this[ i++ ] ) ) { |
|
7096
|
|
|
if ( elem.nodeType === 1 && |
|
7097
|
|
|
( " " + stripAndCollapse( getClass( elem ) ) + " " ).indexOf( className ) > -1 ) { |
|
7098
|
|
|
return true; |
|
7099
|
|
|
} |
|
7100
|
|
|
} |
|
7101
|
|
|
|
|
7102
|
|
|
return false; |
|
7103
|
|
|
} |
|
7104
|
|
|
} ); |
|
7105
|
|
|
|
|
7106
|
|
|
|
|
7107
|
|
|
|
|
7108
|
|
|
|
|
7109
|
|
|
var rreturn = /\r/g; |
|
7110
|
|
|
|
|
7111
|
|
|
jQuery.fn.extend( { |
|
7112
|
|
|
val: function( value ) { |
|
7113
|
|
|
var hooks, ret, isFunction, |
|
7114
|
|
|
elem = this[ 0 ]; |
|
7115
|
|
|
|
|
7116
|
|
|
if ( !arguments.length ) { |
|
7117
|
|
|
if ( elem ) { |
|
7118
|
|
|
hooks = jQuery.valHooks[ elem.type ] || |
|
7119
|
|
|
jQuery.valHooks[ elem.nodeName.toLowerCase() ]; |
|
7120
|
|
|
|
|
7121
|
|
|
if ( hooks && |
|
7122
|
|
|
"get" in hooks && |
|
7123
|
|
|
( ret = hooks.get( elem, "value" ) ) !== undefined |
|
7124
|
|
|
) { |
|
7125
|
|
|
return ret; |
|
7126
|
|
|
} |
|
7127
|
|
|
|
|
7128
|
|
|
ret = elem.value; |
|
7129
|
|
|
|
|
7130
|
|
|
// Handle most common string cases |
|
7131
|
|
|
if ( typeof ret === "string" ) { |
|
7132
|
|
|
return ret.replace( rreturn, "" ); |
|
7133
|
|
|
} |
|
7134
|
|
|
|
|
7135
|
|
|
// Handle cases where value is null/undef or number |
|
7136
|
|
|
return ret == null ? "" : ret; |
|
7137
|
|
|
} |
|
7138
|
|
|
|
|
7139
|
|
|
return; |
|
7140
|
|
|
} |
|
7141
|
|
|
|
|
7142
|
|
|
isFunction = jQuery.isFunction( value ); |
|
7143
|
|
|
|
|
7144
|
|
|
return this.each( function( i ) { |
|
7145
|
|
|
var val; |
|
7146
|
|
|
|
|
7147
|
|
|
if ( this.nodeType !== 1 ) { |
|
7148
|
|
|
return; |
|
7149
|
|
|
} |
|
7150
|
|
|
|
|
7151
|
|
|
if ( isFunction ) { |
|
7152
|
|
|
val = value.call( this, i, jQuery( this ).val() ); |
|
7153
|
|
|
} else { |
|
7154
|
|
|
val = value; |
|
7155
|
|
|
} |
|
7156
|
|
|
|
|
7157
|
|
|
// Treat null/undefined as ""; convert numbers to string |
|
7158
|
|
|
if ( val == null ) { |
|
7159
|
|
|
val = ""; |
|
7160
|
|
|
|
|
7161
|
|
|
} else if ( typeof val === "number" ) { |
|
7162
|
|
|
val += ""; |
|
7163
|
|
|
|
|
7164
|
|
|
} else if ( jQuery.isArray( val ) ) { |
|
7165
|
|
|
val = jQuery.map( val, function( value ) { |
|
7166
|
|
|
return value == null ? "" : value + ""; |
|
7167
|
|
|
} ); |
|
7168
|
|
|
} |
|
7169
|
|
|
|
|
7170
|
|
|
hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ]; |
|
7171
|
|
|
|
|
7172
|
|
|
// If set returns undefined, fall back to normal setting |
|
7173
|
|
|
if ( !hooks || !( "set" in hooks ) || hooks.set( this, val, "value" ) === undefined ) { |
|
7174
|
|
|
this.value = val; |
|
7175
|
|
|
} |
|
7176
|
|
|
} ); |
|
7177
|
|
|
} |
|
7178
|
|
|
} ); |
|
7179
|
|
|
|
|
7180
|
|
|
jQuery.extend( { |
|
7181
|
|
|
valHooks: { |
|
7182
|
|
|
option: { |
|
7183
|
|
|
get: function( elem ) { |
|
7184
|
|
|
|
|
7185
|
|
|
var val = jQuery.find.attr( elem, "value" ); |
|
7186
|
|
|
return val != null ? |
|
7187
|
|
|
val : |
|
7188
|
|
|
|
|
7189
|
|
|
// Support: IE <=10 - 11 only |
|
7190
|
|
|
// option.text throws exceptions (#14686, #14858) |
|
7191
|
|
|
// Strip and collapse whitespace |
|
7192
|
|
|
// https://html.spec.whatwg.org/#strip-and-collapse-whitespace |
|
7193
|
|
|
stripAndCollapse( jQuery.text( elem ) ); |
|
7194
|
|
|
} |
|
7195
|
|
|
}, |
|
7196
|
|
|
select: { |
|
7197
|
|
|
get: function( elem ) { |
|
7198
|
|
|
var value, option, i, |
|
7199
|
|
|
options = elem.options, |
|
7200
|
|
|
index = elem.selectedIndex, |
|
7201
|
|
|
one = elem.type === "select-one", |
|
7202
|
|
|
values = one ? null : [], |
|
7203
|
|
|
max = one ? index + 1 : options.length; |
|
7204
|
|
|
|
|
7205
|
|
|
if ( index < 0 ) { |
|
7206
|
|
|
i = max; |
|
7207
|
|
|
|
|
7208
|
|
|
} else { |
|
7209
|
|
|
i = one ? index : 0; |
|
7210
|
|
|
} |
|
7211
|
|
|
|
|
7212
|
|
|
// Loop through all the selected options |
|
7213
|
|
|
for ( ; i < max; i++ ) { |
|
7214
|
|
|
option = options[ i ]; |
|
7215
|
|
|
|
|
7216
|
|
|
// Support: IE <=9 only |
|
7217
|
|
|
// IE8-9 doesn't update selected after form reset (#2551) |
|
7218
|
|
|
if ( ( option.selected || i === index ) && |
|
7219
|
|
|
|
|
7220
|
|
|
// Don't return options that are disabled or in a disabled optgroup |
|
7221
|
|
|
!option.disabled && |
|
7222
|
|
|
( !option.parentNode.disabled || |
|
7223
|
|
|
!jQuery.nodeName( option.parentNode, "optgroup" ) ) ) { |
|
7224
|
|
|
|
|
7225
|
|
|
// Get the specific value for the option |
|
7226
|
|
|
value = jQuery( option ).val(); |
|
7227
|
|
|
|
|
7228
|
|
|
// We don't need an array for one selects |
|
7229
|
|
|
if ( one ) { |
|
7230
|
|
|
return value; |
|
7231
|
|
|
} |
|
7232
|
|
|
|
|
7233
|
|
|
// Multi-Selects return an array |
|
7234
|
|
|
values.push( value ); |
|
7235
|
|
|
} |
|
7236
|
|
|
} |
|
7237
|
|
|
|
|
7238
|
|
|
return values; |
|
7239
|
|
|
}, |
|
7240
|
|
|
|
|
7241
|
|
|
set: function( elem, value ) { |
|
7242
|
|
|
var optionSet, option, |
|
7243
|
|
|
options = elem.options, |
|
7244
|
|
|
values = jQuery.makeArray( value ), |
|
7245
|
|
|
i = options.length; |
|
7246
|
|
|
|
|
7247
|
|
|
while ( i-- ) { |
|
7248
|
|
|
option = options[ i ]; |
|
7249
|
|
|
|
|
7250
|
|
|
/* eslint-disable no-cond-assign */ |
|
7251
|
|
|
|
|
7252
|
|
|
if ( option.selected = |
|
7253
|
|
|
jQuery.inArray( jQuery.valHooks.option.get( option ), values ) > -1 |
|
7254
|
|
|
) { |
|
7255
|
|
|
optionSet = true; |
|
7256
|
|
|
} |
|
7257
|
|
|
|
|
7258
|
|
|
/* eslint-enable no-cond-assign */ |
|
7259
|
|
|
} |
|
7260
|
|
|
|
|
7261
|
|
|
// Force browsers to behave consistently when non-matching value is set |
|
7262
|
|
|
if ( !optionSet ) { |
|
7263
|
|
|
elem.selectedIndex = -1; |
|
7264
|
|
|
} |
|
7265
|
|
|
return values; |
|
7266
|
|
|
} |
|
7267
|
|
|
} |
|
7268
|
|
|
} |
|
7269
|
|
|
} ); |
|
7270
|
|
|
|
|
7271
|
|
|
// Radios and checkboxes getter/setter |
|
7272
|
|
|
jQuery.each( [ "radio", "checkbox" ], function() { |
|
7273
|
|
|
jQuery.valHooks[ this ] = { |
|
7274
|
|
|
set: function( elem, value ) { |
|
7275
|
|
|
if ( jQuery.isArray( value ) ) { |
|
7276
|
|
|
return ( elem.checked = jQuery.inArray( jQuery( elem ).val(), value ) > -1 ); |
|
7277
|
|
|
} |
|
7278
|
|
|
} |
|
7279
|
|
|
}; |
|
7280
|
|
|
if ( !support.checkOn ) { |
|
7281
|
|
|
jQuery.valHooks[ this ].get = function( elem ) { |
|
7282
|
|
|
return elem.getAttribute( "value" ) === null ? "on" : elem.value; |
|
7283
|
|
|
}; |
|
7284
|
|
|
} |
|
7285
|
|
|
} ); |
|
7286
|
|
|
|
|
7287
|
|
|
|
|
7288
|
|
|
|
|
7289
|
|
|
|
|
7290
|
|
|
// Return jQuery for attributes-only inclusion |
|
7291
|
|
|
|
|
7292
|
|
|
|
|
7293
|
|
|
var rfocusMorph = /^(?:focusinfocus|focusoutblur)$/; |
|
7294
|
|
|
|
|
7295
|
|
|
jQuery.extend( jQuery.event, { |
|
7296
|
|
|
|
|
7297
|
|
|
trigger: function( event, data, elem, onlyHandlers ) { |
|
7298
|
|
|
|
|
7299
|
|
|
var i, cur, tmp, bubbleType, ontype, handle, special, |
|
7300
|
|
|
eventPath = [ elem || document ], |
|
7301
|
|
|
type = hasOwn.call( event, "type" ) ? event.type : event, |
|
7302
|
|
|
namespaces = hasOwn.call( event, "namespace" ) ? event.namespace.split( "." ) : []; |
|
7303
|
|
|
|
|
7304
|
|
|
cur = tmp = elem = elem || document; |
|
7305
|
|
|
|
|
7306
|
|
|
// Don't do events on text and comment nodes |
|
7307
|
|
|
if ( elem.nodeType === 3 || elem.nodeType === 8 ) { |
|
7308
|
|
|
return; |
|
7309
|
|
|
} |
|
7310
|
|
|
|
|
7311
|
|
|
// focus/blur morphs to focusin/out; ensure we're not firing them right now |
|
7312
|
|
|
if ( rfocusMorph.test( type + jQuery.event.triggered ) ) { |
|
7313
|
|
|
return; |
|
7314
|
|
|
} |
|
7315
|
|
|
|
|
7316
|
|
|
if ( type.indexOf( "." ) > -1 ) { |
|
7317
|
|
|
|
|
7318
|
|
|
// Namespaced trigger; create a regexp to match event type in handle() |
|
7319
|
|
|
namespaces = type.split( "." ); |
|
7320
|
|
|
type = namespaces.shift(); |
|
7321
|
|
|
namespaces.sort(); |
|
7322
|
|
|
} |
|
7323
|
|
|
ontype = type.indexOf( ":" ) < 0 && "on" + type; |
|
7324
|
|
|
|
|
7325
|
|
|
// Caller can pass in a jQuery.Event object, Object, or just an event type string |
|
7326
|
|
|
event = event[ jQuery.expando ] ? |
|
7327
|
|
|
event : |
|
7328
|
|
|
new jQuery.Event( type, typeof event === "object" && event ); |
|
7329
|
|
|
|
|
7330
|
|
|
// Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true) |
|
7331
|
|
|
event.isTrigger = onlyHandlers ? 2 : 3; |
|
7332
|
|
|
event.namespace = namespaces.join( "." ); |
|
7333
|
|
|
event.rnamespace = event.namespace ? |
|
7334
|
|
|
new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" ) : |
|
7335
|
|
|
null; |
|
7336
|
|
|
|
|
7337
|
|
|
// Clean up the event in case it is being reused |
|
7338
|
|
|
event.result = undefined; |
|
7339
|
|
|
if ( !event.target ) { |
|
7340
|
|
|
event.target = elem; |
|
7341
|
|
|
} |
|
7342
|
|
|
|
|
7343
|
|
|
// Clone any incoming data and prepend the event, creating the handler arg list |
|
7344
|
|
|
data = data == null ? |
|
7345
|
|
|
[ event ] : |
|
7346
|
|
|
jQuery.makeArray( data, [ event ] ); |
|
7347
|
|
|
|
|
7348
|
|
|
// Allow special events to draw outside the lines |
|
7349
|
|
|
special = jQuery.event.special[ type ] || {}; |
|
7350
|
|
|
if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) { |
|
7351
|
|
|
return; |
|
7352
|
|
|
} |
|
7353
|
|
|
|
|
7354
|
|
|
// Determine event propagation path in advance, per W3C events spec (#9951) |
|
7355
|
|
|
// Bubble up to document, then to window; watch for a global ownerDocument var (#9724) |
|
7356
|
|
|
if ( !onlyHandlers && !special.noBubble && !jQuery.isWindow( elem ) ) { |
|
7357
|
|
|
|
|
7358
|
|
|
bubbleType = special.delegateType || type; |
|
7359
|
|
|
if ( !rfocusMorph.test( bubbleType + type ) ) { |
|
7360
|
|
|
cur = cur.parentNode; |
|
7361
|
|
|
} |
|
7362
|
|
|
for ( ; cur; cur = cur.parentNode ) { |
|
7363
|
|
|
eventPath.push( cur ); |
|
7364
|
|
|
tmp = cur; |
|
7365
|
|
|
} |
|
7366
|
|
|
|
|
7367
|
|
|
// Only add window if we got to document (e.g., not plain obj or detached DOM) |
|
7368
|
|
|
if ( tmp === ( elem.ownerDocument || document ) ) { |
|
7369
|
|
|
eventPath.push( tmp.defaultView || tmp.parentWindow || window ); |
|
7370
|
|
|
} |
|
7371
|
|
|
} |
|
7372
|
|
|
|
|
7373
|
|
|
// Fire handlers on the event path |
|
7374
|
|
|
i = 0; |
|
7375
|
|
|
while ( ( cur = eventPath[ i++ ] ) && !event.isPropagationStopped() ) { |
|
7376
|
|
|
|
|
7377
|
|
|
event.type = i > 1 ? |
|
7378
|
|
|
bubbleType : |
|
7379
|
|
|
special.bindType || type; |
|
7380
|
|
|
|
|
7381
|
|
|
// jQuery handler |
|
7382
|
|
|
handle = ( dataPriv.get( cur, "events" ) || {} )[ event.type ] && |
|
7383
|
|
|
dataPriv.get( cur, "handle" ); |
|
7384
|
|
|
if ( handle ) { |
|
7385
|
|
|
handle.apply( cur, data ); |
|
7386
|
|
|
} |
|
7387
|
|
|
|
|
7388
|
|
|
// Native handler |
|
7389
|
|
|
handle = ontype && cur[ ontype ]; |
|
7390
|
|
|
if ( handle && handle.apply && acceptData( cur ) ) { |
|
7391
|
|
|
event.result = handle.apply( cur, data ); |
|
7392
|
|
|
if ( event.result === false ) { |
|
7393
|
|
|
event.preventDefault(); |
|
7394
|
|
|
} |
|
7395
|
|
|
} |
|
7396
|
|
|
} |
|
7397
|
|
|
event.type = type; |
|
7398
|
|
|
|
|
7399
|
|
|
// If nobody prevented the default action, do it now |
|
7400
|
|
|
if ( !onlyHandlers && !event.isDefaultPrevented() ) { |
|
7401
|
|
|
|
|
7402
|
|
|
if ( ( !special._default || |
|
7403
|
|
|
special._default.apply( eventPath.pop(), data ) === false ) && |
|
7404
|
|
|
acceptData( elem ) ) { |
|
7405
|
|
|
|
|
7406
|
|
|
// Call a native DOM method on the target with the same name as the event. |
|
7407
|
|
|
// Don't do default actions on window, that's where global variables be (#6170) |
|
7408
|
|
|
if ( ontype && jQuery.isFunction( elem[ type ] ) && !jQuery.isWindow( elem ) ) { |
|
7409
|
|
|
|
|
7410
|
|
|
// Don't re-trigger an onFOO event when we call its FOO() method |
|
7411
|
|
|
tmp = elem[ ontype ]; |
|
7412
|
|
|
|
|
7413
|
|
|
if ( tmp ) { |
|
7414
|
|
|
elem[ ontype ] = null; |
|
7415
|
|
|
} |
|
7416
|
|
|
|
|
7417
|
|
|
// Prevent re-triggering of the same event, since we already bubbled it above |
|
7418
|
|
|
jQuery.event.triggered = type; |
|
7419
|
|
|
elem[ type ](); |
|
7420
|
|
|
jQuery.event.triggered = undefined; |
|
7421
|
|
|
|
|
7422
|
|
|
if ( tmp ) { |
|
7423
|
|
|
elem[ ontype ] = tmp; |
|
7424
|
|
|
} |
|
7425
|
|
|
} |
|
7426
|
|
|
} |
|
7427
|
|
|
} |
|
7428
|
|
|
|
|
7429
|
|
|
return event.result; |
|
7430
|
|
|
}, |
|
7431
|
|
|
|
|
7432
|
|
|
// Piggyback on a donor event to simulate a different one |
|
7433
|
|
|
// Used only for `focus(in | out)` events |
|
7434
|
|
|
simulate: function( type, elem, event ) { |
|
7435
|
|
|
var e = jQuery.extend( |
|
7436
|
|
|
new jQuery.Event(), |
|
7437
|
|
|
event, |
|
7438
|
|
|
{ |
|
7439
|
|
|
type: type, |
|
7440
|
|
|
isSimulated: true |
|
7441
|
|
|
} |
|
7442
|
|
|
); |
|
7443
|
|
|
|
|
7444
|
|
|
jQuery.event.trigger( e, null, elem ); |
|
7445
|
|
|
} |
|
7446
|
|
|
|
|
7447
|
|
|
} ); |
|
7448
|
|
|
|
|
7449
|
|
|
jQuery.fn.extend( { |
|
7450
|
|
|
|
|
7451
|
|
|
trigger: function( type, data ) { |
|
7452
|
|
|
return this.each( function() { |
|
7453
|
|
|
jQuery.event.trigger( type, data, this ); |
|
7454
|
|
|
} ); |
|
7455
|
|
|
}, |
|
7456
|
|
|
triggerHandler: function( type, data ) { |
|
7457
|
|
|
var elem = this[ 0 ]; |
|
7458
|
|
|
if ( elem ) { |
|
7459
|
|
|
return jQuery.event.trigger( type, data, elem, true ); |
|
7460
|
|
|
} |
|
7461
|
|
|
} |
|
7462
|
|
|
} ); |
|
7463
|
|
|
|
|
7464
|
|
|
|
|
7465
|
|
|
jQuery.each( ( "blur focus focusin focusout resize scroll click dblclick " + |
|
7466
|
|
|
"mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " + |
|
7467
|
|
|
"change select submit keydown keypress keyup contextmenu" ).split( " " ), |
|
7468
|
|
|
function( i, name ) { |
|
7469
|
|
|
|
|
7470
|
|
|
// Handle event binding |
|
7471
|
|
|
jQuery.fn[ name ] = function( data, fn ) { |
|
7472
|
|
|
return arguments.length > 0 ? |
|
7473
|
|
|
this.on( name, null, data, fn ) : |
|
7474
|
|
|
this.trigger( name ); |
|
7475
|
|
|
}; |
|
7476
|
|
|
} ); |
|
7477
|
|
|
|
|
7478
|
|
|
jQuery.fn.extend( { |
|
7479
|
|
|
hover: function( fnOver, fnOut ) { |
|
7480
|
|
|
return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver ); |
|
7481
|
|
|
} |
|
7482
|
|
|
} ); |
|
7483
|
|
|
|
|
7484
|
|
|
|
|
7485
|
|
|
|
|
7486
|
|
|
|
|
7487
|
|
|
support.focusin = "onfocusin" in window; |
|
7488
|
|
|
|
|
7489
|
|
|
|
|
7490
|
|
|
// Support: Firefox <=44 |
|
7491
|
|
|
// Firefox doesn't have focus(in | out) events |
|
7492
|
|
|
// Related ticket - https://bugzilla.mozilla.org/show_bug.cgi?id=687787 |
|
7493
|
|
|
// |
|
7494
|
|
|
// Support: Chrome <=48 - 49, Safari <=9.0 - 9.1 |
|
7495
|
|
|
// focus(in | out) events fire after focus & blur events, |
|
7496
|
|
|
// which is spec violation - http://www.w3.org/TR/DOM-Level-3-Events/#events-focusevent-event-order |
|
7497
|
|
|
// Related ticket - https://bugs.chromium.org/p/chromium/issues/detail?id=449857 |
|
7498
|
|
|
if ( !support.focusin ) { |
|
7499
|
|
|
jQuery.each( { focus: "focusin", blur: "focusout" }, function( orig, fix ) { |
|
7500
|
|
|
|
|
7501
|
|
|
// Attach a single capturing handler on the document while someone wants focusin/focusout |
|
7502
|
|
|
var handler = function( event ) { |
|
7503
|
|
|
jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ) ); |
|
7504
|
|
|
}; |
|
7505
|
|
|
|
|
7506
|
|
|
jQuery.event.special[ fix ] = { |
|
7507
|
|
|
setup: function() { |
|
7508
|
|
|
var doc = this.ownerDocument || this, |
|
7509
|
|
|
attaches = dataPriv.access( doc, fix ); |
|
7510
|
|
|
|
|
7511
|
|
|
if ( !attaches ) { |
|
7512
|
|
|
doc.addEventListener( orig, handler, true ); |
|
7513
|
|
|
} |
|
7514
|
|
|
dataPriv.access( doc, fix, ( attaches || 0 ) + 1 ); |
|
7515
|
|
|
}, |
|
7516
|
|
|
teardown: function() { |
|
7517
|
|
|
var doc = this.ownerDocument || this, |
|
7518
|
|
|
attaches = dataPriv.access( doc, fix ) - 1; |
|
7519
|
|
|
|
|
7520
|
|
|
if ( !attaches ) { |
|
7521
|
|
|
doc.removeEventListener( orig, handler, true ); |
|
7522
|
|
|
dataPriv.remove( doc, fix ); |
|
7523
|
|
|
|
|
7524
|
|
|
} else { |
|
7525
|
|
|
dataPriv.access( doc, fix, attaches ); |
|
7526
|
|
|
} |
|
7527
|
|
|
} |
|
7528
|
|
|
}; |
|
7529
|
|
|
} ); |
|
7530
|
|
|
} |
|
7531
|
|
|
|
|
7532
|
|
|
|
|
7533
|
|
|
var |
|
7534
|
|
|
rbracket = /\[\]$/, |
|
7535
|
|
|
rCRLF = /\r?\n/g, |
|
7536
|
|
|
rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i, |
|
7537
|
|
|
rsubmittable = /^(?:input|select|textarea|keygen)/i; |
|
7538
|
|
|
|
|
7539
|
|
|
function buildParams( prefix, obj, traditional, add ) { |
|
7540
|
|
|
var name; |
|
7541
|
|
|
|
|
7542
|
|
|
if ( jQuery.isArray( obj ) ) { |
|
7543
|
|
|
|
|
7544
|
|
|
// Serialize array item. |
|
7545
|
|
|
jQuery.each( obj, function( i, v ) { |
|
7546
|
|
|
if ( traditional || rbracket.test( prefix ) ) { |
|
7547
|
|
|
|
|
7548
|
|
|
// Treat each array item as a scalar. |
|
7549
|
|
|
add( prefix, v ); |
|
7550
|
|
|
|
|
7551
|
|
|
} else { |
|
7552
|
|
|
|
|
7553
|
|
|
// Item is non-scalar (array or object), encode its numeric index. |
|
7554
|
|
|
buildParams( |
|
7555
|
|
|
prefix + "[" + ( typeof v === "object" && v != null ? i : "" ) + "]", |
|
7556
|
|
|
v, |
|
7557
|
|
|
traditional, |
|
7558
|
|
|
add |
|
7559
|
|
|
); |
|
7560
|
|
|
} |
|
7561
|
|
|
} ); |
|
7562
|
|
|
|
|
7563
|
|
|
} else if ( !traditional && jQuery.type( obj ) === "object" ) { |
|
7564
|
|
|
|
|
7565
|
|
|
// Serialize object item. |
|
7566
|
|
|
for ( name in obj ) { |
|
7567
|
|
|
buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add ); |
|
7568
|
|
|
} |
|
7569
|
|
|
|
|
7570
|
|
|
} else { |
|
7571
|
|
|
|
|
7572
|
|
|
// Serialize scalar item. |
|
7573
|
|
|
add( prefix, obj ); |
|
7574
|
|
|
} |
|
7575
|
|
|
} |
|
7576
|
|
|
|
|
7577
|
|
|
// Serialize an array of form elements or a set of |
|
7578
|
|
|
// key/values into a query string |
|
7579
|
|
|
jQuery.param = function( a, traditional ) { |
|
7580
|
|
|
var prefix, |
|
7581
|
|
|
s = [], |
|
7582
|
|
|
add = function( key, valueOrFunction ) { |
|
7583
|
|
|
|
|
7584
|
|
|
// If value is a function, invoke it and use its return value |
|
7585
|
|
|
var value = jQuery.isFunction( valueOrFunction ) ? |
|
7586
|
|
|
valueOrFunction() : |
|
7587
|
|
|
valueOrFunction; |
|
7588
|
|
|
|
|
7589
|
|
|
s[ s.length ] = encodeURIComponent( key ) + "=" + |
|
7590
|
|
|
encodeURIComponent( value == null ? "" : value ); |
|
7591
|
|
|
}; |
|
7592
|
|
|
|
|
7593
|
|
|
// If an array was passed in, assume that it is an array of form elements. |
|
7594
|
|
|
if ( jQuery.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) { |
|
7595
|
|
|
|
|
7596
|
|
|
// Serialize the form elements |
|
7597
|
|
|
jQuery.each( a, function() { |
|
7598
|
|
|
add( this.name, this.value ); |
|
7599
|
|
|
} ); |
|
7600
|
|
|
|
|
7601
|
|
|
} else { |
|
7602
|
|
|
|
|
7603
|
|
|
// If traditional, encode the "old" way (the way 1.3.2 or older |
|
7604
|
|
|
// did it), otherwise encode params recursively. |
|
7605
|
|
|
for ( prefix in a ) { |
|
7606
|
|
|
buildParams( prefix, a[ prefix ], traditional, add ); |
|
7607
|
|
|
} |
|
7608
|
|
|
} |
|
7609
|
|
|
|
|
7610
|
|
|
// Return the resulting serialization |
|
7611
|
|
|
return s.join( "&" ); |
|
7612
|
|
|
}; |
|
7613
|
|
|
|
|
7614
|
|
|
jQuery.fn.extend( { |
|
7615
|
|
|
serialize: function() { |
|
7616
|
|
|
return jQuery.param( this.serializeArray() ); |
|
7617
|
|
|
}, |
|
7618
|
|
|
serializeArray: function() { |
|
7619
|
|
|
return this.map( function() { |
|
7620
|
|
|
|
|
7621
|
|
|
// Can add propHook for "elements" to filter or add form elements |
|
7622
|
|
|
var elements = jQuery.prop( this, "elements" ); |
|
7623
|
|
|
return elements ? jQuery.makeArray( elements ) : this; |
|
7624
|
|
|
} ) |
|
7625
|
|
|
.filter( function() { |
|
7626
|
|
|
var type = this.type; |
|
7627
|
|
|
|
|
7628
|
|
|
// Use .is( ":disabled" ) so that fieldset[disabled] works |
|
7629
|
|
|
return this.name && !jQuery( this ).is( ":disabled" ) && |
|
7630
|
|
|
rsubmittable.test( this.nodeName ) && !rsubmitterTypes.test( type ) && |
|
7631
|
|
|
( this.checked || !rcheckableType.test( type ) ); |
|
7632
|
|
|
} ) |
|
7633
|
|
|
.map( function( i, elem ) { |
|
7634
|
|
|
var val = jQuery( this ).val(); |
|
7635
|
|
|
|
|
7636
|
|
|
if ( val == null ) { |
|
7637
|
|
|
return null; |
|
7638
|
|
|
} |
|
7639
|
|
|
|
|
7640
|
|
|
if ( jQuery.isArray( val ) ) { |
|
7641
|
|
|
return jQuery.map( val, function( val ) { |
|
7642
|
|
|
return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) }; |
|
7643
|
|
|
} ); |
|
7644
|
|
|
} |
|
7645
|
|
|
|
|
7646
|
|
|
return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) }; |
|
7647
|
|
|
} ).get(); |
|
7648
|
|
|
} |
|
7649
|
|
|
} ); |
|
7650
|
|
|
|
|
7651
|
|
|
|
|
7652
|
|
|
jQuery.fn.extend( { |
|
7653
|
|
|
wrapAll: function( html ) { |
|
7654
|
|
|
var wrap; |
|
7655
|
|
|
|
|
7656
|
|
|
if ( this[ 0 ] ) { |
|
7657
|
|
|
if ( jQuery.isFunction( html ) ) { |
|
7658
|
|
|
html = html.call( this[ 0 ] ); |
|
7659
|
|
|
} |
|
7660
|
|
|
|
|
7661
|
|
|
// The elements to wrap the target around |
|
7662
|
|
|
wrap = jQuery( html, this[ 0 ].ownerDocument ).eq( 0 ).clone( true ); |
|
7663
|
|
|
|
|
7664
|
|
|
if ( this[ 0 ].parentNode ) { |
|
7665
|
|
|
wrap.insertBefore( this[ 0 ] ); |
|
7666
|
|
|
} |
|
7667
|
|
|
|
|
7668
|
|
|
wrap.map( function() { |
|
7669
|
|
|
var elem = this; |
|
7670
|
|
|
|
|
7671
|
|
|
while ( elem.firstElementChild ) { |
|
7672
|
|
|
elem = elem.firstElementChild; |
|
7673
|
|
|
} |
|
7674
|
|
|
|
|
7675
|
|
|
return elem; |
|
7676
|
|
|
} ).append( this ); |
|
7677
|
|
|
} |
|
7678
|
|
|
|
|
7679
|
|
|
return this; |
|
7680
|
|
|
}, |
|
7681
|
|
|
|
|
7682
|
|
|
wrapInner: function( html ) { |
|
7683
|
|
|
if ( jQuery.isFunction( html ) ) { |
|
7684
|
|
|
return this.each( function( i ) { |
|
7685
|
|
|
jQuery( this ).wrapInner( html.call( this, i ) ); |
|
7686
|
|
|
} ); |
|
7687
|
|
|
} |
|
7688
|
|
|
|
|
7689
|
|
|
return this.each( function() { |
|
7690
|
|
|
var self = jQuery( this ), |
|
7691
|
|
|
contents = self.contents(); |
|
7692
|
|
|
|
|
7693
|
|
|
if ( contents.length ) { |
|
7694
|
|
|
contents.wrapAll( html ); |
|
7695
|
|
|
|
|
7696
|
|
|
} else { |
|
7697
|
|
|
self.append( html ); |
|
7698
|
|
|
} |
|
7699
|
|
|
} ); |
|
7700
|
|
|
}, |
|
7701
|
|
|
|
|
7702
|
|
|
wrap: function( html ) { |
|
7703
|
|
|
var isFunction = jQuery.isFunction( html ); |
|
7704
|
|
|
|
|
7705
|
|
|
return this.each( function( i ) { |
|
7706
|
|
|
jQuery( this ).wrapAll( isFunction ? html.call( this, i ) : html ); |
|
7707
|
|
|
} ); |
|
7708
|
|
|
}, |
|
7709
|
|
|
|
|
7710
|
|
|
unwrap: function( selector ) { |
|
7711
|
|
|
this.parent( selector ).not( "body" ).each( function() { |
|
7712
|
|
|
jQuery( this ).replaceWith( this.childNodes ); |
|
7713
|
|
|
} ); |
|
7714
|
|
|
return this; |
|
7715
|
|
|
} |
|
7716
|
|
|
} ); |
|
7717
|
|
|
|
|
7718
|
|
|
|
|
7719
|
|
|
jQuery.expr.pseudos.hidden = function( elem ) { |
|
7720
|
|
|
return !jQuery.expr.pseudos.visible( elem ); |
|
7721
|
|
|
}; |
|
7722
|
|
|
jQuery.expr.pseudos.visible = function( elem ) { |
|
7723
|
|
|
return !!( elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length ); |
|
7724
|
|
|
}; |
|
7725
|
|
|
|
|
7726
|
|
|
|
|
7727
|
|
|
|
|
7728
|
|
|
|
|
7729
|
|
|
// Support: Safari 8 only |
|
7730
|
|
|
// In Safari 8 documents created via document.implementation.createHTMLDocument |
|
7731
|
|
|
// collapse sibling forms: the second one becomes a child of the first one. |
|
7732
|
|
|
// Because of that, this security measure has to be disabled in Safari 8. |
|
7733
|
|
|
// https://bugs.webkit.org/show_bug.cgi?id=137337 |
|
7734
|
|
|
support.createHTMLDocument = ( function() { |
|
7735
|
|
|
var body = document.implementation.createHTMLDocument( "" ).body; |
|
7736
|
|
|
body.innerHTML = "<form></form><form></form>"; |
|
7737
|
|
|
return body.childNodes.length === 2; |
|
7738
|
|
|
} )(); |
|
7739
|
|
|
|
|
7740
|
|
|
|
|
7741
|
|
|
// Argument "data" should be string of html |
|
7742
|
|
|
// context (optional): If specified, the fragment will be created in this context, |
|
7743
|
|
|
// defaults to document |
|
7744
|
|
|
// keepScripts (optional): If true, will include scripts passed in the html string |
|
7745
|
|
|
jQuery.parseHTML = function( data, context, keepScripts ) { |
|
7746
|
|
|
if ( typeof data !== "string" ) { |
|
7747
|
|
|
return []; |
|
7748
|
|
|
} |
|
7749
|
|
|
if ( typeof context === "boolean" ) { |
|
7750
|
|
|
keepScripts = context; |
|
7751
|
|
|
context = false; |
|
7752
|
|
|
} |
|
7753
|
|
|
|
|
7754
|
|
|
var base, parsed, scripts; |
|
7755
|
|
|
|
|
7756
|
|
|
if ( !context ) { |
|
7757
|
|
|
|
|
7758
|
|
|
// Stop scripts or inline event handlers from being executed immediately |
|
7759
|
|
|
// by using document.implementation |
|
7760
|
|
|
if ( support.createHTMLDocument ) { |
|
7761
|
|
|
context = document.implementation.createHTMLDocument( "" ); |
|
7762
|
|
|
|
|
7763
|
|
|
// Set the base href for the created document |
|
7764
|
|
|
// so any parsed elements with URLs |
|
7765
|
|
|
// are based on the document's URL (gh-2965) |
|
7766
|
|
|
base = context.createElement( "base" ); |
|
7767
|
|
|
base.href = document.location.href; |
|
7768
|
|
|
context.head.appendChild( base ); |
|
7769
|
|
|
} else { |
|
7770
|
|
|
context = document; |
|
7771
|
|
|
} |
|
7772
|
|
|
} |
|
7773
|
|
|
|
|
7774
|
|
|
parsed = rsingleTag.exec( data ); |
|
7775
|
|
|
scripts = !keepScripts && []; |
|
7776
|
|
|
|
|
7777
|
|
|
// Single tag |
|
7778
|
|
|
if ( parsed ) { |
|
7779
|
|
|
return [ context.createElement( parsed[ 1 ] ) ]; |
|
7780
|
|
|
} |
|
7781
|
|
|
|
|
7782
|
|
|
parsed = buildFragment( [ data ], context, scripts ); |
|
7783
|
|
|
|
|
7784
|
|
|
if ( scripts && scripts.length ) { |
|
7785
|
|
|
jQuery( scripts ).remove(); |
|
7786
|
|
|
} |
|
7787
|
|
|
|
|
7788
|
|
|
return jQuery.merge( [], parsed.childNodes ); |
|
7789
|
|
|
}; |
|
7790
|
|
|
|
|
7791
|
|
|
|
|
7792
|
|
|
/** |
|
7793
|
|
|
* Gets a window from an element |
|
7794
|
|
|
*/ |
|
7795
|
|
|
function getWindow( elem ) { |
|
7796
|
|
|
return jQuery.isWindow( elem ) ? elem : elem.nodeType === 9 && elem.defaultView; |
|
7797
|
|
|
} |
|
7798
|
|
|
|
|
7799
|
|
|
jQuery.offset = { |
|
7800
|
|
|
setOffset: function( elem, options, i ) { |
|
7801
|
|
|
var curPosition, curLeft, curCSSTop, curTop, curOffset, curCSSLeft, calculatePosition, |
|
7802
|
|
|
position = jQuery.css( elem, "position" ), |
|
7803
|
|
|
curElem = jQuery( elem ), |
|
7804
|
|
|
props = {}; |
|
7805
|
|
|
|
|
7806
|
|
|
// Set position first, in-case top/left are set even on static elem |
|
7807
|
|
|
if ( position === "static" ) { |
|
7808
|
|
|
elem.style.position = "relative"; |
|
7809
|
|
|
} |
|
7810
|
|
|
|
|
7811
|
|
|
curOffset = curElem.offset(); |
|
7812
|
|
|
curCSSTop = jQuery.css( elem, "top" ); |
|
7813
|
|
|
curCSSLeft = jQuery.css( elem, "left" ); |
|
7814
|
|
|
calculatePosition = ( position === "absolute" || position === "fixed" ) && |
|
7815
|
|
|
( curCSSTop + curCSSLeft ).indexOf( "auto" ) > -1; |
|
7816
|
|
|
|
|
7817
|
|
|
// Need to be able to calculate position if either |
|
7818
|
|
|
// top or left is auto and position is either absolute or fixed |
|
7819
|
|
|
if ( calculatePosition ) { |
|
7820
|
|
|
curPosition = curElem.position(); |
|
7821
|
|
|
curTop = curPosition.top; |
|
7822
|
|
|
curLeft = curPosition.left; |
|
7823
|
|
|
|
|
7824
|
|
|
} else { |
|
7825
|
|
|
curTop = parseFloat( curCSSTop ) || 0; |
|
7826
|
|
|
curLeft = parseFloat( curCSSLeft ) || 0; |
|
7827
|
|
|
} |
|
7828
|
|
|
|
|
7829
|
|
|
if ( jQuery.isFunction( options ) ) { |
|
7830
|
|
|
|
|
7831
|
|
|
// Use jQuery.extend here to allow modification of coordinates argument (gh-1848) |
|
7832
|
|
|
options = options.call( elem, i, jQuery.extend( {}, curOffset ) ); |
|
7833
|
|
|
} |
|
7834
|
|
|
|
|
7835
|
|
|
if ( options.top != null ) { |
|
7836
|
|
|
props.top = ( options.top - curOffset.top ) + curTop; |
|
7837
|
|
|
} |
|
7838
|
|
|
if ( options.left != null ) { |
|
7839
|
|
|
props.left = ( options.left - curOffset.left ) + curLeft; |
|
7840
|
|
|
} |
|
7841
|
|
|
|
|
7842
|
|
|
if ( "using" in options ) { |
|
7843
|
|
|
options.using.call( elem, props ); |
|
7844
|
|
|
|
|
7845
|
|
|
} else { |
|
7846
|
|
|
curElem.css( props ); |
|
7847
|
|
|
} |
|
7848
|
|
|
} |
|
7849
|
|
|
}; |
|
7850
|
|
|
|
|
7851
|
|
|
jQuery.fn.extend( { |
|
7852
|
|
|
offset: function( options ) { |
|
7853
|
|
|
|
|
7854
|
|
|
// Preserve chaining for setter |
|
7855
|
|
|
if ( arguments.length ) { |
|
7856
|
|
|
return options === undefined ? |
|
7857
|
|
|
this : |
|
7858
|
|
|
this.each( function( i ) { |
|
7859
|
|
|
jQuery.offset.setOffset( this, options, i ); |
|
7860
|
|
|
} ); |
|
7861
|
|
|
} |
|
7862
|
|
|
|
|
7863
|
|
|
var docElem, win, rect, doc, |
|
7864
|
|
|
elem = this[ 0 ]; |
|
7865
|
|
|
|
|
7866
|
|
|
if ( !elem ) { |
|
7867
|
|
|
return; |
|
7868
|
|
|
} |
|
7869
|
|
|
|
|
7870
|
|
|
// Support: IE <=11 only |
|
7871
|
|
|
// Running getBoundingClientRect on a |
|
7872
|
|
|
// disconnected node in IE throws an error |
|
7873
|
|
|
if ( !elem.getClientRects().length ) { |
|
7874
|
|
|
return { top: 0, left: 0 }; |
|
7875
|
|
|
} |
|
7876
|
|
|
|
|
7877
|
|
|
rect = elem.getBoundingClientRect(); |
|
7878
|
|
|
|
|
7879
|
|
|
// Make sure element is not hidden (display: none) |
|
7880
|
|
|
if ( rect.width || rect.height ) { |
|
7881
|
|
|
doc = elem.ownerDocument; |
|
7882
|
|
|
win = getWindow( doc ); |
|
7883
|
|
|
docElem = doc.documentElement; |
|
7884
|
|
|
|
|
7885
|
|
|
return { |
|
7886
|
|
|
top: rect.top + win.pageYOffset - docElem.clientTop, |
|
7887
|
|
|
left: rect.left + win.pageXOffset - docElem.clientLeft |
|
7888
|
|
|
}; |
|
7889
|
|
|
} |
|
7890
|
|
|
|
|
7891
|
|
|
// Return zeros for disconnected and hidden elements (gh-2310) |
|
7892
|
|
|
return rect; |
|
7893
|
|
|
}, |
|
7894
|
|
|
|
|
7895
|
|
|
position: function() { |
|
7896
|
|
|
if ( !this[ 0 ] ) { |
|
7897
|
|
|
return; |
|
7898
|
|
|
} |
|
7899
|
|
|
|
|
7900
|
|
|
var offsetParent, offset, |
|
7901
|
|
|
elem = this[ 0 ], |
|
7902
|
|
|
parentOffset = { top: 0, left: 0 }; |
|
7903
|
|
|
|
|
7904
|
|
|
// Fixed elements are offset from window (parentOffset = {top:0, left: 0}, |
|
7905
|
|
|
// because it is its only offset parent |
|
7906
|
|
|
if ( jQuery.css( elem, "position" ) === "fixed" ) { |
|
7907
|
|
|
|
|
7908
|
|
|
// Assume getBoundingClientRect is there when computed position is fixed |
|
7909
|
|
|
offset = elem.getBoundingClientRect(); |
|
7910
|
|
|
|
|
7911
|
|
|
} else { |
|
7912
|
|
|
|
|
7913
|
|
|
// Get *real* offsetParent |
|
7914
|
|
|
offsetParent = this.offsetParent(); |
|
7915
|
|
|
|
|
7916
|
|
|
// Get correct offsets |
|
7917
|
|
|
offset = this.offset(); |
|
7918
|
|
|
if ( !jQuery.nodeName( offsetParent[ 0 ], "html" ) ) { |
|
7919
|
|
|
parentOffset = offsetParent.offset(); |
|
7920
|
|
|
} |
|
7921
|
|
|
|
|
7922
|
|
|
// Add offsetParent borders |
|
7923
|
|
|
parentOffset = { |
|
7924
|
|
|
top: parentOffset.top + jQuery.css( offsetParent[ 0 ], "borderTopWidth", true ), |
|
7925
|
|
|
left: parentOffset.left + jQuery.css( offsetParent[ 0 ], "borderLeftWidth", true ) |
|
7926
|
|
|
}; |
|
7927
|
|
|
} |
|
7928
|
|
|
|
|
7929
|
|
|
// Subtract parent offsets and element margins |
|
7930
|
|
|
return { |
|
7931
|
|
|
top: offset.top - parentOffset.top - jQuery.css( elem, "marginTop", true ), |
|
7932
|
|
|
left: offset.left - parentOffset.left - jQuery.css( elem, "marginLeft", true ) |
|
7933
|
|
|
}; |
|
7934
|
|
|
}, |
|
7935
|
|
|
|
|
7936
|
|
|
// This method will return documentElement in the following cases: |
|
7937
|
|
|
// 1) For the element inside the iframe without offsetParent, this method will return |
|
7938
|
|
|
// documentElement of the parent window |
|
7939
|
|
|
// 2) For the hidden or detached element |
|
7940
|
|
|
// 3) For body or html element, i.e. in case of the html node - it will return itself |
|
7941
|
|
|
// |
|
7942
|
|
|
// but those exceptions were never presented as a real life use-cases |
|
7943
|
|
|
// and might be considered as more preferable results. |
|
7944
|
|
|
// |
|
7945
|
|
|
// This logic, however, is not guaranteed and can change at any point in the future |
|
7946
|
|
|
offsetParent: function() { |
|
7947
|
|
|
return this.map( function() { |
|
7948
|
|
|
var offsetParent = this.offsetParent; |
|
7949
|
|
|
|
|
7950
|
|
|
while ( offsetParent && jQuery.css( offsetParent, "position" ) === "static" ) { |
|
7951
|
|
|
offsetParent = offsetParent.offsetParent; |
|
7952
|
|
|
} |
|
7953
|
|
|
|
|
7954
|
|
|
return offsetParent || documentElement; |
|
7955
|
|
|
} ); |
|
7956
|
|
|
} |
|
7957
|
|
|
} ); |
|
7958
|
|
|
|
|
7959
|
|
|
// Create scrollLeft and scrollTop methods |
|
7960
|
|
|
jQuery.each( { scrollLeft: "pageXOffset", scrollTop: "pageYOffset" }, function( method, prop ) { |
|
7961
|
|
|
var top = "pageYOffset" === prop; |
|
7962
|
|
|
|
|
7963
|
|
|
jQuery.fn[ method ] = function( val ) { |
|
7964
|
|
|
return access( this, function( elem, method, val ) { |
|
7965
|
|
|
var win = getWindow( elem ); |
|
7966
|
|
|
|
|
7967
|
|
|
if ( val === undefined ) { |
|
7968
|
|
|
return win ? win[ prop ] : elem[ method ]; |
|
7969
|
|
|
} |
|
7970
|
|
|
|
|
7971
|
|
|
if ( win ) { |
|
7972
|
|
|
win.scrollTo( |
|
7973
|
|
|
!top ? val : win.pageXOffset, |
|
7974
|
|
|
top ? val : win.pageYOffset |
|
7975
|
|
|
); |
|
7976
|
|
|
|
|
7977
|
|
|
} else { |
|
7978
|
|
|
elem[ method ] = val; |
|
7979
|
|
|
} |
|
7980
|
|
|
}, method, val, arguments.length ); |
|
7981
|
|
|
}; |
|
7982
|
|
|
} ); |
|
7983
|
|
|
|
|
7984
|
|
|
// Support: Safari <=7 - 9.1, Chrome <=37 - 49 |
|
7985
|
|
|
// Add the top/left cssHooks using jQuery.fn.position |
|
7986
|
|
|
// Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084 |
|
7987
|
|
|
// Blink bug: https://bugs.chromium.org/p/chromium/issues/detail?id=589347 |
|
7988
|
|
|
// getComputedStyle returns percent when specified for top/left/bottom/right; |
|
7989
|
|
|
// rather than make the css module depend on the offset module, just check for it here |
|
7990
|
|
|
jQuery.each( [ "top", "left" ], function( i, prop ) { |
|
7991
|
|
|
jQuery.cssHooks[ prop ] = addGetHookIf( support.pixelPosition, |
|
7992
|
|
|
function( elem, computed ) { |
|
7993
|
|
|
if ( computed ) { |
|
7994
|
|
|
computed = curCSS( elem, prop ); |
|
7995
|
|
|
|
|
7996
|
|
|
// If curCSS returns percentage, fallback to offset |
|
7997
|
|
|
return rnumnonpx.test( computed ) ? |
|
7998
|
|
|
jQuery( elem ).position()[ prop ] + "px" : |
|
7999
|
|
|
computed; |
|
8000
|
|
|
} |
|
8001
|
|
|
} |
|
8002
|
|
|
); |
|
8003
|
|
|
} ); |
|
8004
|
|
|
|
|
8005
|
|
|
|
|
8006
|
|
|
// Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods |
|
8007
|
|
|
jQuery.each( { Height: "height", Width: "width" }, function( name, type ) { |
|
8008
|
|
|
jQuery.each( { padding: "inner" + name, content: type, "": "outer" + name }, |
|
8009
|
|
|
function( defaultExtra, funcName ) { |
|
8010
|
|
|
|
|
8011
|
|
|
// Margin is only for outerHeight, outerWidth |
|
8012
|
|
|
jQuery.fn[ funcName ] = function( margin, value ) { |
|
8013
|
|
|
var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ), |
|
8014
|
|
|
extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" ); |
|
8015
|
|
|
|
|
8016
|
|
|
return access( this, function( elem, type, value ) { |
|
8017
|
|
|
var doc; |
|
8018
|
|
|
|
|
8019
|
|
|
if ( jQuery.isWindow( elem ) ) { |
|
8020
|
|
|
|
|
8021
|
|
|
// $( window ).outerWidth/Height return w/h including scrollbars (gh-1729) |
|
8022
|
|
|
return funcName.indexOf( "outer" ) === 0 ? |
|
8023
|
|
|
elem[ "inner" + name ] : |
|
8024
|
|
|
elem.document.documentElement[ "client" + name ]; |
|
8025
|
|
|
} |
|
8026
|
|
|
|
|
8027
|
|
|
// Get document width or height |
|
8028
|
|
|
if ( elem.nodeType === 9 ) { |
|
8029
|
|
|
doc = elem.documentElement; |
|
8030
|
|
|
|
|
8031
|
|
|
// Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height], |
|
8032
|
|
|
// whichever is greatest |
|
8033
|
|
|
return Math.max( |
|
8034
|
|
|
elem.body[ "scroll" + name ], doc[ "scroll" + name ], |
|
8035
|
|
|
elem.body[ "offset" + name ], doc[ "offset" + name ], |
|
8036
|
|
|
doc[ "client" + name ] |
|
8037
|
|
|
); |
|
8038
|
|
|
} |
|
8039
|
|
|
|
|
8040
|
|
|
return value === undefined ? |
|
8041
|
|
|
|
|
8042
|
|
|
// Get width or height on the element, requesting but not forcing parseFloat |
|
8043
|
|
|
jQuery.css( elem, type, extra ) : |
|
8044
|
|
|
|
|
8045
|
|
|
// Set width or height on the element |
|
8046
|
|
|
jQuery.style( elem, type, value, extra ); |
|
8047
|
|
|
}, type, chainable ? margin : undefined, chainable ); |
|
8048
|
|
|
}; |
|
8049
|
|
|
} ); |
|
8050
|
|
|
} ); |
|
8051
|
|
|
|
|
8052
|
|
|
|
|
8053
|
|
|
// Register as a named AMD module, since jQuery can be concatenated with other |
|
8054
|
|
|
// files that may use define, but not via a proper concatenation script that |
|
8055
|
|
|
// understands anonymous AMD modules. A named AMD is safest and most robust |
|
8056
|
|
|
// way to register. Lowercase jquery is used because AMD module names are |
|
8057
|
|
|
// derived from file names, and jQuery is normally delivered in a lowercase |
|
8058
|
|
|
// file name. Do this after creating the global so that if an AMD module wants |
|
8059
|
|
|
// to call noConflict to hide this version of jQuery, it will work. |
|
8060
|
|
|
|
|
8061
|
|
|
// Note that for maximum portability, libraries that are not jQuery should |
|
8062
|
|
|
// declare themselves as anonymous modules, and avoid setting a global if an |
|
8063
|
|
|
// AMD loader is present. jQuery is a special case. For more information, see |
|
8064
|
|
|
// https://github.com/jrburke/requirejs/wiki/Updating-existing-libraries#wiki-anon |
|
8065
|
|
|
|
|
8066
|
|
|
if ( typeof define === "function" && define.amd ) { |
|
8067
|
|
|
define( "jquery", [], function() { |
|
8068
|
|
|
return jQuery; |
|
8069
|
|
|
} ); |
|
8070
|
|
|
} |
|
8071
|
|
|
|
|
8072
|
|
|
|
|
8073
|
|
|
|
|
8074
|
|
|
|
|
8075
|
|
|
var |
|
8076
|
|
|
|
|
8077
|
|
|
// Map over jQuery in case of overwrite |
|
8078
|
|
|
_jQuery = window.jQuery, |
|
8079
|
|
|
|
|
8080
|
|
|
// Map over the $ in case of overwrite |
|
8081
|
|
|
_$ = window.$; |
|
8082
|
|
|
|
|
8083
|
|
|
jQuery.noConflict = function( deep ) { |
|
8084
|
|
|
if ( window.$ === jQuery ) { |
|
8085
|
|
|
window.$ = _$; |
|
8086
|
|
|
} |
|
8087
|
|
|
|
|
8088
|
|
|
if ( deep && window.jQuery === jQuery ) { |
|
8089
|
|
|
window.jQuery = _jQuery; |
|
8090
|
|
|
} |
|
8091
|
|
|
|
|
8092
|
|
|
return jQuery; |
|
8093
|
|
|
}; |
|
8094
|
|
|
|
|
8095
|
|
|
// Expose jQuery and $ identifiers, even in AMD |
|
8096
|
|
|
// (#7102#comment:10, https://github.com/jquery/jquery/pull/557) |
|
8097
|
|
|
// and CommonJS for browser emulators (#13566) |
|
8098
|
|
|
if ( !noGlobal ) { |
|
8099
|
|
|
window.jQuery = window.$ = jQuery; |
|
8100
|
|
|
} |
|
8101
|
|
|
|
|
8102
|
|
|
|
|
8103
|
|
|
|
|
8104
|
|
|
|
|
8105
|
|
|
|
|
8106
|
|
|
return jQuery; |
|
8107
|
|
|
} ); |
|
8108
|
|
|
|